环境配置:
1. 安装ubuntu 16.04 系统
不同的版本,会有不同的依赖库,其它ubuntu版本请参考对应版本的安装步骤.
UEFI 启动模式安装ubuntu
网上有很多安装文章(自己硬盘分区),不过测试都没有成功,最终傻瓜式的一路安装成功.
简述步骤:插入准备好的UEFI 模式usb启动盘,惠普PC按F10 进入BIOS,选择UEFI USB盘启动,之后一路傻瓜安装(安装 类型选择"清除整个磁盘并安装ubuntu").
2.安装openjdk
sudo apt-get update
sudo apt-get install openjdk-8-jdk
3. 安装依赖库
sudo apt-get install git-core gnupg flex bison gperf build-essential sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib sudo apt-get install libc6-dev-i386 sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev sudo apt-get install lib32z-dev ccache sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip sudo apt-get install libssl-dev sudo apt-get install python-requests
4. 安装repo
-
Make sure you have a bin/ directory in your home directory and that it is included in your path:
mkdir ~/bin
PATH=~/bin:$PATH
-
Download the Repo tool and ensure that it is executable:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
- 设定环境变量
~/.bashrc 文件末尾添加:PATH=~/bin:$PATH
5. 配置git(默认git编辑器为emacs)
git config --global user.name "Your Name"
git config --global user.email "you@example.com" git config --global core.editor vim
6. Sync 代码 以及build代码(这部分网上很多资料,不细写)
注意的部分: jack-server out of memory
$ export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8
-XX:+TieredCompilation -Xmx8192m"
$ out/host/linux-x86/bin/jack-admin kill-server
$ out/host/linux-x86/bin/jack-admin start-server
7. 安装android studio(启动的时候会自动下载sdk 工具)
查找adb下载的位置,并设置环境变量,这样可以通过adb操作手机.
例如:~/.bashrc中的修改部分
PATH=~/tool/bin:~/bin:$PATH
PATH=~/Android/Sdk/platform-tools:$PATH
8. Reference
https://source.android.com/setup/build/downloading
https://source.android.com/setup/build/initializing
https://www.cnblogs.com/wanqieddy/archive/2012/08/03/2621027.html
https://blog.csdn.net/fuchaosz/article/details/51487585/
https://www.cnblogs.com/tsts/p/7554703.html
https://blog.csdn.net/ztguang/article/details/52853397
https://developer.android.com/studio/index.html