在ubuntu12.04上编译 android源代码(二)

接着上一篇介绍,接下来要从网上下载android源代码

1)安装Repo

mkdir ~/bin

PATH=~/bin:$PATH

curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

chmod a+x ~/bin/repo

2)初始化Repo客户端

mkdir WORKING_DIRECTORY

cd WORKING_DIRECTORY

repo init -u https://android.googlesource.com/platform/manifest

repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1

repo sync

这个过程比较漫长,可能需要两三天时间,如果中间电脑关机了,下次开机的时候在终端中输入

repo sync 继续下载即可。

android源代码下载完毕之后,接下来要做的就是编译源代码,进入源代码目录后执行make就可以了。

第一次编译可能花费的时间比较长,中间肯能出现各种错误,这个时候要耐心解决,最后一定会编译成功的。

android源代码编译成功之后,可以用以下命令将其打包成SDK:

make sdk

打包成功后,可以看到下面的输出:

有了这个SDK包之后,我们就可源在IDE环境中开发Android应用程序了。

********************************************************************************************************************************************

我在编译的过错中出现过以下错误:

Package SDK: out/host/linux-x86/sdk/android-sdk_eng.wangwei_linux-x86.zip

development/build/sdk.atree:229: couldn't locate source file: framework/layoutlib-tests.jar
development/build/sdk.atree:230: couldn't locate source file: system/app/ConnectivityTest.apk
development/build/sdk.atree:231: couldn't locate source file: system/app/GpsLocationTest.apk
sdk/build/tools.atree:47: couldn't locate source file: usr/share/pc-bios/bios.bin
sdk/build/tools.atree:48: couldn't locate source file: usr/share/pc-bios/vgabios-cirrus.bin
sdk/build/tools.atree:146: couldn't locate source file: framework/ddmlib-tests.jar
sdk/build/tools.atree:147: couldn't locate source file: framework/ninepatch-tests.jar
sdk/build/tools.atree:148: couldn't locate source file: framework/common-tests.jar
sdk/build/tools.atree:149: couldn't locate source file: framework/sdklib-tests.jar
sdk/build/tools.atree:150: couldn't locate source file: framework/sdkuilib-tests.jar

make: *** [out/host/linux-x86/sdk/android-sdk_eng.wangwei_linux-x86.zip] 错误 44

解决方法如下:

$ source build/envsetup.sh

initialize some commands for android compile system

$lunch sdk-eng

The item have not been listed in the printed console list, but it still support the function

$make sdk

posted on 2012-12-18 14:46  金蛇郎君的世界  阅读(603)  评论(0编辑  收藏  举报

导航