首页 > 代码库 > Ubuntu 16.04 LTS

Ubuntu 16.04 LTS

Ubuntu 16.04 LTS  64位系统 针对Android 6.0

sudo apt install git-core bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip g++-multilib gcc-multilib lib32ncurses5-dev lib32readline6-dev libc6-dev-i386 x11proto-core-dev libx11-dev ccache libgl1-mesa-dev unzip python-imaging lib32z1-dev


下载安装openjdk

Ubuntu16默认使用的JDK是Openjdk8,而编译Android6.0源码需要Openjdk7,这时通过apt-get下载不到Openjdk7!因为Ubuntu 16已经将它从源码库里移除了,解决方法是手动添加仓库再下载安装:

sudo add-apt-repository ppa:openjdk-r/ppa

sudo apt-get update

sudo apt-get install openjdk-7-jdk

 

java -version

javac -version

 

//更改jdk版本

sudo update-alternatives --config java

sudo update-alternatives --config javac



提高编译效率

(1) 在 .bashrc文件末尾添加:export USE_CCACHE = 1

    或者终端输入命令:echo export USE_CCACHE=1 >> ~/.bashrc

 

(2) 为了提高编译效率,设置编译器高速缓存:

    prebuilts/misc/linux-x86/ccache/ccache -M 50G


常见错误


git错误

git clone时出现,unable to negotiate with 10.0.0.8: no matching key exchange methodfound. Their offer: diffie-hellman-group1-sha1
解决:
    打开.bashrc文件,在终端输入:$ vim ~/.bashrc  ,然后向.bashrc文件写入:
    export GIT_SSH_COMMAND=‘ssh -o KexAlgorithms=+diffie-hellman-group1-sha1‘

 

clang链接错误

编译报错recipe for target ‘out/host/linux-x86/obj/lib/libart.so‘ failed 
解决:
在android源码文件下art/build/Android.common_build.mk这个文件中找到
# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),true)
  # By default, host builds use clang for better warnings.
   ART_HOST_CLANG := true # 改为 ART_HOST_CLANG := false
endif

splashimage错误:

vendor/letv/proprietary/hwconfig/bootlogo/Android.mk:10: recipe for target ‘splashimage‘ failed

python版本高,需要替换个方法:

find ./vendor/letv/proprietary/hwconfig/bootlogo/ -name ‘logo_gen.py‘|xargs perl -pi -e ‘s|tostring|tobytes|g‘

Ubuntu 16.04 LTS