ubuntu14.10上编译Android5.0.2源码

2015年04月14日 Android 暂无评论 阅读17172次

ubuntu14.10上编译Android5.0.2源码

前面一篇文章说到了ubuntu14.10上Android5.0.2源码下载的具体步骤,这篇文章说的是ubuntu14.10上编译Android5.0.2源码的那些事。

1.先安装jdk

这里我使用的是openjdk,网上很多人关于jdk到底使用jdk5、jdk6、jdk7还是openjdk一直在争论不休,我选择的是openjdk7,最终证明是可以编译通过的。

sudo apt-get install openjdk-7-jdk

安装好后,设置环境变量:

sudo gedit/etc/profile

 文件末尾加上

 JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/  

 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin

 export JAVA_HOME  

 export PATH

2.安装ccache

 sudo apt-get install ccache

 source ~/.bashrc

3.安装其他依赖的软件

勿必提前安装好,否则编译时出错,会浪费N多时间。

sudo apt-get install git-core

sudo apt-get install git

sudo apt-get install gnupg

sudo apt-get install flex

sudo apt-get install bison

sudo apt-get install gperf

sudo apt-get install build-essential

sudo apt-get install zip

sudo apt-get install curl

sudo apt-get install libc6-dev

sudo apt-get install libncurses5-dev:i386

sudo apt-get install x11proto-core-dev

sudo apt-get install libx11-dev:i386

sudo apt-get install libreadline6-dev:i386

sudo apt-get install libgl1-mesa-dev

sudo apt-get install g++-multilib

sudo apt-get install mingw32

sudo apt-get install tofrodos

sudo apt-get install python-markdown

sudo apt-get install libxml2-utils

sudo apt-get install xsltproc

sudo apt-get install zlib1g-dev:i386

sudo apt-get install dpkg-dev

4.下载其他硬件驱动

到这里,依赖软件基本完成,剩下的就根据自己的需求,下载其他硬件驱动了,我是用编译Nexus6的系统image镜像,所以还需要下载Nexus6的硬件驱动,详细可参照这篇文章。

http://jileniao.net/post-154.html

5.进入到源码目录

  cd android  

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

6.加载环境变量

. build/envsetup.sh

7.选择lunch选项

 lunch

根据测试机器Nexus6,也就是shamu,所以我选择的是21

8.开始编译

make

最终编译完成,我耗时11小时48分钟。

Image

host C++: liblatinime_host_static_for_unittests_32 <= packages/inputmethods/LatinIME/native/jni/src/suggest/policyimpl/dictionary/structure/backward/v402/content/shortcut_dict_content.cpp

host C++: liblatinime_host_static_for_unittests_32 <= packages/inputmethods/LatinIME/native/jni/src/suggest/policyimpl/dictionary/structure/backward/v402/content/sparse_table_dict_content.cpp

host C++: liblatinime_host_static_for_unittests_32 <= packages/inputmethods/LatinIME/native/jni/src/suggest/policyimpl/dictionary/structure/backward/v402/content/terminal_position_lookup_table.cpp

host C++: liblatinime_host_static_for_unittests_32 <= packages/inputmethods/LatinIME/native/jni/src/suggest/policyimpl/dictionary/structure/backward/v402/bigram/ver4_bigram_list_policy.cpp

host StaticLib: liblatinime_host_static_for_unittests_32 (out/host/linux-x86/obj32/STATIC_LIBRARIES/liblatinime_host_static_for_unittests_intermediates/liblatinime_host_static_for_unittests.a)

Export includes file: packages/inputmethods/LatinIME/native/jni/HostUnitTests.mk -- out/host/linux-x86/obj32/EXECUTABLES/liblatinime_host_unittests_intermediates/export_includes

host Executable: liblatinime_host_unittests (out/host/linux-x86/obj32/EXECUTABLES/liblatinime_host_unittests_intermediates/liblatinime_host_unittests)

#### make completed successfully (11:48:27 (hh:mm:ss)) ####


编译中我遇到了编译到libwebviewchromium.so时停止很长时间最后发生错误的问题,解决方法请参照下面这篇文章。

http://jileniao.net/ubunt-add-swap-to-build-libwebviewchromium.html


至此,文末。。。。

分享本文至:

WRITTEN BY

avatar
看了本文是不是觉得很赞,那就赶紧点击下面按钮分享给身边的朋友吧!

欢迎留言




用户登录

sitemap