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 出现 ...
随机推荐
- (八十七)AutoLayout的简单介绍与实例
AutoLayout是继AutoResizing之后的一种自己主动布局方法.攻克了AutoResizing无法处理控件间相互关系的问题. AutoLayout在storyboard中通过底部工具条设置 ...
- QT - 内存泄漏检测
一.安装vld-2.5.1-setup.exe 下载地址:https://archive.codeplex.com/?p=vld 二.pro中添加头文件目录与库目录 INCLUDEPATH += &q ...
- 阿里NLP总监分享-NLP技术的应用与思考
https://yq.aliyun.com/articles/78031 NLP技术的应用及思考
- 对象引用 方法传参 值传递 引用传递 易错点 MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- jquery的$.extend和$.fn.extend作用及区别,兼它们的一些小细节
$.extend(obj);是为了扩展jquery本身,为类添加新的方法 $.fn.extend(obj);给JQUERY对象添加方法.如(1): $.extend({ add:function( ...
- OJ模板库
近期刷了好几次的oj,好受伤好多都是相似的题目. 最长回文子串 string preprocess(string &str) { string afterProcessStr="#& ...
- 基于双向LSTM和迁移学习的seq2seq核心实体识别
http://spaces.ac.cn/archives/3942/ 暑假期间做了一下百度和西安交大联合举办的核心实体识别竞赛,最终的结果还不错,遂记录一下.模型的效果不是最好的,但是胜在“端到端”, ...
- 文本相似度-BM25算法
BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms app ...
- 阿里云centos 6安装iRedmail过程
全新系统 yum update cd /root wget http://www.iredmail.com/iRedMail-0.8.7.tar.bz2 tar xvf iRedMail-0.8.7. ...
- Office办公 如何给WPS 的文字添加黑框
双击文本框,弹出的设置对象格式中选择线条颜色和样式即可 要做成虚线框也是可以的 弄完之后字体也可以改大一点 还有一种需要时文本不在黑框的中间位置,比如顶部的某个位置,可以设置文字锁定点是顶 ...