Ubuntu18.04下的 Android Studio 3.1.2
Android Studio安装
参考官网上的安装说明
# 安装依赖
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++:i386 lib32z1 libbz2-1.0:i386
安装openjdk (Update 2018-08-21: 这次重装Ubuntu18.04.1后, 仅仅设置了java, javac的软链, 没有安装openjdk, 也可以正常启动android studio)
sudo apt-get install openjdk--jdk
解压缩后运行 bin/studio.sh 会自动安装, 但是不会自动创建应用图标, 需要自己创建
安装过程中SDK Manager需要下载指定版本的Android Platform, 以及SDK Tools, 现在下载速度非常快了. 之后才能创建项目
创建图标
在路径 /usr/share/applications下创建.desktop文件, 内容如下
/usr/share/applications$ sudo vi android-studio.desktop [Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Icon=/opt/google/android-studio/bin/studio.png
Exec="/opt/google/android-studio/bin/studio.sh" %f
Comment=The Drive to Develop
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-studio
对于最后一个参数StartupWMClass的值, 如果未正确设置的话, 在导航栏里的图标会不能和运行中的实例正常关联, 运行时会同时显示两个图标. 关于如何获取这个参数值, 参考这个说明 https://askubuntu.com/questions/367396/what-represent-the-startupwmclass-field-of-a-desktop-file 可以通过xprop WM_CLASS命令查看
Modern Linux desktop environments (Gnome 3, Ubuntu Unity, Docky) use the WMClass property to associate windows with the owning application. Many Java-based applications have the problem where the windows created by the application are not associated with the shortcut used to start the application (so the dock contains multiple copies of the same icon).
So the field called StartupWMClass is a string that defines in which class the application is grouped in the Unity Launcher at startup. You can find out which WM_CLASS your window has got when you type in a terminal, and then click at the window. The output is as follows:
$ xprop WM_CLASS
WM_CLASS(STRING) = "sun-awt-X11-XFramePeer", "jetbrains-studio"
创建并编译空白项目
项目初次Sync时容易失败, 一些依赖包总是下载错误, 这时候需要检查一下 home目录下的 .gradle/gradle.properties文件, 是否这里设置了错误的代理. 这个在studio的settings里面是看不到的.
在物理设备上run空白项目
报udev相关的permission错误时, 会建议你安装 sudo apt install android-tools-adb 但是这个貌似不起作用, 命令行执行 adb devices依然报permissions不足, 后来通过在/etc/udev/rules.d/ 下增加如下内容的文件 51-android.rules, 才解决问题. 重新插拔手机后, adb devices能看到设备了
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE:="0666"
创建虚拟设备运行项目
在AVD管理器中创建虚拟设备时, 出现提示 /dev/kvm device: permission denied . 这是因为当前用户不在kvm组里的原因, 在Ubuntu18.04下解决方式如下:
# 首先, 安装 qemu-kvm
sudo apt install qemu-kvm
# 查看 /dev/kvm的权限和用户组, 如果安装过了qemu-kvm, 这个设备的组应该就会变成kvm
ls -al /dev/kvm
# 检查当前用户的组, 查看系统里存在的组
id
more /etc/group
# 如果kvm组已经存在, 将当前用户加入kvm组
sudo gpasswd -a milton kvm
# 查看是否已经加入, 用户会被附加在组名后面
more /etc/group
打开华为安卓手机的日志输出
华为的安卓手机默认不输出INFO级别以下的日志, 需要手动打开, 方法是拨号面板上输入 *#*#2846579#*#* 进入工程模式后, 在LOG设置中, 勾选所有的输出.
若是小米4.0系统(MIUI),进入“设置-->全部设置-->原厂设置-->工程模式”
Ubuntu18.04下的 Android Studio 3.1.2的更多相关文章
- ubuntu18.04 下启动Android Studio报错KVM is required to run this AVD. /dev/kvm device: permission denied.
		
在ubuntu18.04下安装Android Studio,安装了模拟器后运行报错 KVM is required to run this AVD. /dev/kvm device: permissi ...
 - ubuntu 14.10 lts 64-bits环境下使用Android Studio
		
距离google发布android studio 1.0正式版已经两个月左右了.由于一直习惯使用eclipse+ADT的模式,而且曾在windows下试用一次Android Studio预览版,感觉卡 ...
 - 【转载】菜鸟Ubuntu下安装Android Studio
		
原文:http://forum.android-studio.org/forum.php?mod=viewthread&tid=236&extra=page%3D1%26filter% ...
 - 在Mac OS X下安装Android Studio
		
在Mac OS X下安装Android Studio只需要几步. 1. 下载Android Studio安装包(.dmg). 2. 打开Terminal输入java -version命令查看是否已安装 ...
 - [Android Studio 权威教程]Windows下安装Android Studio
		
从AS 0.5版本号開始使用.也是AS的推行者,在ApkBus公布的第一篇Android Studio Perview 2 获得了50K的浏览,1800多条回复下载. 在我的[Android Stud ...
 - Mac下改动Android Studio 所用的JDK版本号
		
Mac下改动Android Studio 所用的JDK版本号 @author ASCE1885 近期项目从Eclipse+Ant构建模式转移到了Android Studio+Gradle构建模式.自然 ...
 - Ubuntu18.04下安装搜狗输入法
		
Ubuntu18.04下安装搜狗输入法 第一步:安装 fcitx输入框架 sudo apt-get install fcitx 第二步:在官网下载 Linux 版本搜狗输入法 https://piny ...
 - Ubuntu18.04下给PyCharm创建快捷方式
		
Ubuntu18.04下给PyCharm创建快捷方式 该方法 WebStorm.PyCharm.Clion 等都适用. 步骤 终端输入: sudo gedit /usr/share/applicati ...
 - ubuntu18.04 下利用conda安装opencv3
		
ubuntu18.04 下利用conda安装opencv3 安装opencv3 conda install -c https://conda.anaconda.org/menpo opencv3 出现 ...
 
随机推荐
- Java NIO AsynchronousFileChannel
			
In Java 7 the AsynchronousFileChannel was added to Java NIO. The AsynchronousFileChannel makes it po ...
 - Java NIO Pipe
			
A Java NIO Pipe is a one-way data connection between two threads. A Pipe has a source channel and a ...
 - 整理:FPGA选型
			
针对性整理下FPGA选型问题 一.获取芯片资料: 要做芯片的选型,首先就是要对有可能要面对的芯片有整体的了解,也就是说要尽可能多的先获取芯片的资料.现在FPGA主要有4个生产厂家,ALTERA,XIL ...
 - maven-assembly-plugin 入门指南
			
当你使用 Maven 对项目打包时,你需要了解以下 3 个打包 plugin,它们分别是 plugin function maven-jar-plugin maven 默认打包插件,用来创建 proj ...
 - Round() 四舍五入 js银行家算法
			
首先问一下round(0.825,2) 返回的结果,大家猜一猜, 首先SQL server 返回的是 0.83 js的返回结果 是0.83,code 如下: var b = 0.825; ...
 - ASP.NET MVC2之Model Binder
			
Model Binder在Asp.net MVC中非常简单.简单的说就是你控制器中的Action方法需要参数数据:而这些参数数据包含在HTTP请求中,包括表单上的Value和URL中的参 数等.而Mo ...
 - Reverse Words in a String leetcode java
			
题目: Given an input string, reverse the string word by word. For example, Given s = "the sky is ...
 - Word Search leetcode java
			
题目: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed fr ...
 - Java复习1-基本数据类型
			
数据类型 整形 type 存储 取值范围 int 4字节 -2 147 483 648 ~ 2 147 483 647 (超过20亿) short 2字节 -32 768 ~ 32 7677 long ...
 - AVR单片机最小系统 基本硬件线路与分析
			
单片机最小系统 单片机最小系统设计 AVR基本硬件线路设计与分析 (ATmega16功能小板) AVR DB-CORE Ver2.3 Atmega16开发板 本站商城提供本最小系统销售:99元 AV ...