在32位Ubuntu 10.04上编译Android 2.3
本人在Ubuntu 10.04系统 32位机上安装编译Android2.3源码,其步骤和注意事项如下:
1.安装JDK6
对于Android2.3系统,不要安装JDK5,应该安装最新的JDK6。
如果安装了JDK6,Android会自动按64位编译,如果系统是32位的,会有编译错误,后面会说如何修改这个错误。
2. 安装各种包
$ sudo aptitude install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
3. 安装Repo
$ mkdir ~/bin
$ export PATH=~/bin:$PATH
$ curl http://android.git.kernel.org/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
4. 下载Android源码
$mkdir ~/android2.3
$cd ~/android2.3
$ repo init -u git://android.git.kernel.org/platform/manifest.git
$ repo sync
这一步持续时间很长,整个源码+SDK共5G左右,我是下载了一个晚上才搞定,网速不给力啊。。。
5. 编译Android2.3
先export ANDROID_JAVA_HOME=$JAVA_HOME
#ifneq (64,$(findstring 64,$(build_arch)))
#$(warning ************************************************************)
#$(warning You are attempting to build on a 32-bit system.)
#$(warning Only 64-bit build environments are supported beyond froyo/2.2.)
#$(warning ************************************************************)
#$(error stop)
#endif
重新make,如果是安装了JDK6版本,会又报错:
修改这几个文件,该回到32位编译环境即可:
external/clearsilver/cgi/Android.mk external/clearsilver/java-jni/Android.mk external/clearsilver/util/Android.mk external/clearsilver/cs/Android.mk
1.安装JDK6
对于Android2.3系统,不要安装JDK5,应该安装最新的JDK6。
如果安装了JDK6,Android会自动按64位编译,如果系统是32位的,会有编译错误,后面会说如何修改这个错误。
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
sudo update-java-alternatives -s java-6-sun
安装完后,需要手动设置JAVA_HOME, JRE_HOME, CLASS_PATH为JDK6的安装路径。sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
sudo update-java-alternatives -s java-6-sun
2. 安装各种包
$ sudo aptitude install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
3. 安装Repo
$ mkdir ~/bin
$ export PATH=~/bin:$PATH
$ curl http://android.git.kernel.org/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
4. 下载Android源码
$mkdir ~/android2.3
$cd ~/android2.3
$ repo init -u git://android.git.kernel.org/platform/manifest.git
$ repo sync
这一步持续时间很长,整个源码+SDK共5G左右,我是下载了一个晚上才搞定,网速不给力啊。。。
5. 编译Android2.3
先export ANDROID_JAVA_HOME=$JAVA_HOME
$ cd ~/android2.3
$ source build/envsetup.sh
$ lunch
$ make
在make的时候会提示出错:$ source build/envsetup.sh
$ lunch
$ make
因为Android2.3默认是64位的系统上编译,需要手动修改build/core/main.mk,把这个判断部分注释掉:************************************************************
You are attempting to build on a 32-bit system.
Only 64-bit build environments are supported beyond froyo/2.2.
************************************************************
#ifneq (64,$(findstring 64,$(build_arch)))
#$(warning ************************************************************)
#$(warning You are attempting to build on a 32-bit system.)
#$(warning Only 64-bit build environments are supported beyond froyo/2.2.)
#$(warning ************************************************************)
#$(error stop)
#endif
重新make,如果是安装了JDK6版本,会又报错:
这是由于clearsilver在编译时如果检测到使用Java JDK 6,就使用64位编译,因为Google的一个员工更新了几个文件。这里可以看到详细的修改记录:http://android.git.kernel.org/?p=platform/external/clearsilver.git;a=commitdiff;h=d36910a8110d8377b22301274d2b5131a732a72bDocs droiddoc: out/target/common/docs/api-stubs
Could not load ‘clearsilver-jni’
java.library.path = out/host/linux-x86/lib
make: *** [out/target/common/docs/api-stubs-timestamp] Error 45
make: *** Waiting for unfinished jobs….
Could not load ‘clearsilver-jni’
java.library.path = out/host/linux-x86/lib
make: *** [out/target/common/docs/doc-comment-check-timestamp] Error 45
修改这几个文件,该回到32位编译环境即可:
external/clearsilver/cgi/Android.mk external/clearsilver/java-jni/Android.mk external/clearsilver/util/Android.mk external/clearsilver/cs/Android.mk
把编译选项-m64改成-m32即可
重新make,大概不到一个小时就make完了。
相关推荐
spb 2020-05-02
pengjin 2019-12-21
csdnuuu 2019-12-04
qawsedpl 2010-10-07
gongzhiyao0 2010-08-17
zhonglinzhang 2010-08-11
fengyeezju 2019-11-14
yinbaoshiguang 2011-03-12
西木 2011-02-27
downtown 2011-02-18
berber 2011-02-18
wintering 2011-01-03
fuzhangandroid 2010-12-10
rookieding 2010-10-26
yinbaoshiguang 2011-08-25
chenjinlong 2011-08-23
rookieding 2011-08-21
wenjs00 2011-06-30
IZZY 2011-05-13