Ubuntu 14.04.1 建立 Android M, Android N 開發環境 與 問題

# Modify /etc/apt/sources.list

# add below 3 lines to /etc/apt/sources.list

sudo vim /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse

# Required Packages

sudo su -

apt-get update

sudo apt-get -y install bison g++-multilib git;

sudo apt-get -y install gperf libxml2-utils make python-networkx zlib1g-dev:i386 zip

sudo apt-get -y install build-essential

# Install open JDK 1.7 (for L, M)
sudo apt-get -y install openjdk-7-jdk

# Install open JDK 1.8 (for N)
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get -y install openjdk-8-jdk

# for repo command

sudo apt-get install phablet-tools

# for git
sudo apt-get install python-software-properties libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install gitk

# for ssh
ssh-keygen -t rsa -C yoursetting@yoursetting.com.tw
cat ~/.ssh/id_rsa.pub
copy the contents to Settings(gerrit) -> SSH Public Keys

  


1:

build error

error message --->>>

Out of memory error (version 1.2-rc4 'Carnac' (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by android-jack-team@google.com)).

GC overhead limit exceeded.

solve --->>>                原先只有 8G,加大 memory 即可解決,多加 1 條 16G 的 memory

 原因                         :   memory 太少


error while loading shared libraries: libp11.so.2: cannot open shared object file: No such file or directory

solve --->>>

Please execute below command after build error .

sudo apt-get install libp11-2


加速 build code 速度

$ export USE_CCACHE=1
$ export CCACHE_DIR=~/.ccache
$ prebuilts/misc/linux-x86/ccache/ccache -M 50G

Put the following in your .bashrc (or equivalent):

export USE_CCACHE=1

On Linux, you can watch ccache being used by doing the following:

$ watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s


trouble shooting

ubuntu14.04 下,

使用 mtk 的 sp_flash tool download image,若發生 error,

可以執行以下指令後,再 download image。

sudo apt-get purge modemmanager

reference to  :

1. MTK document     Android_Build_Environment_on_Ubuntu_14.04_64-bit_Installation_SOP.pdf

2. https://source.android.com/source/initializing.html

原文地址:https://www.cnblogs.com/youchihwang/p/6119403.html