android build 9,在ubuntu9.10下build android

I was devastated by Android these days

let me organize some noticeable points here

(ubuntu 8.10 is used)

1. download Android source code (cupcake)

create home:

:mkdir AndroidHome

install Git:

:sudo apt-get install git-core

install Repo:

:curl http://android.git.kernel.org/repo > ~/AndroidHome/bin/repo

:chmod a+x ~/AndroidHome/bin/repo

install Python:

:sudo apt-get install python

install JDK 1.6:

:cd ~/AndroidHome/downloads

:chmode a+x jdk-6u11-linux-i586.bin

:.jdk-6u11-linux-i586.bin

:cp -R jdk1.6.0_11/ /usr/local/jdk1.6.0_11/

add followings to ~/.bashrc:

:export PATH=/usr/local/jdk1.6.0_11/bin:$PATH

:export JAVA_HOME=/usr/local/jdk1.6.0_11

:export ANDROID_JAVA_HOME=$JAVA_HOME

start to download:

:cd ~/AndroidHome/

:repo init -u git://android.git.kernel.org/platform/manifest.git-b cupcake

(or :repo init -u git://android.git.kernel.org/platform/manifest.git -b release-1.0 for older version)

:repo sync

2. make Android source code

:make

The following error occurs

external/qemu/sockets.c: In function ?sock_address_init_resolve?:

external/qemu/sockets.c:637: error: ?EAI_NODATA? undeclared (first use

in this function)

external/qemu/sockets.c:637: error: (Each undeclared identifier is

reported only once

external/qemu/sockets.c:637: error: for each function it appears in.)

solution:

add “#if …” and “#endif” before and after case EAI_NODATA in sockets.c

#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME

case EAI_NODATA:

#endif

case EAI_NONAME:

err = ENOENT;

break;

after that, another ploblem occurs

the process is killed while making dex file

the reason is that the memory is not enough

it seams that at least 1.5G RAM and 10G HD space is required

so I setup the swap space to 2G

:dd if=/dev/zero of=/swapfile bs=1024 count=2000000

:mkswap /swapfile

:swapon /swapfile

:/swapfile swap swap defaults 0 0

finally, the make finished, which took about 4~6 hours

after the build success, the apk files will be in out/target/product/generic/system/app

3. make SDK

** important: JDK 1.5, not 1.6, must be used **

otherwise, the following error will occur:

javadoc: error – In doclet class DroidDoc,  method start has thrown an

exception java.lang.reflect.InvocationTargetException

com.sun.tools.javac.code.Symbol$CompletionFailure: class file for

sun.util.resources.OpenListResourceBundle not found

1 error

make: *** [out/target/common/docs/dx-timestamp] Error 45

:make sdk

4. make ADT

If you use Android 1.5 SDK, you have to update the ADT to 0.9.0

Otherwise, there will errors occur

Normally, the update of ADK can be done easily through the “Software Updates” in eclipse

However, the ADT server cannot be connected to these days

Even the older version (0.8.0) is also not available

So, you have to make it by yourself

:development/tools/eclipse/scripts/build_server.sh ~/adt/

And then, how to install it into the eclipse?

choose “help” -> “Software Updates” -> “Add Site” -> “Local”

and then select the folder of ADT

5. create AVD (Android Virtual Device)

you have to create AVD for, otherwise, eclipse may display the following error:

Failed to find an AVD compatible with target ‘Android 1.5′. Launch aborted.

D:\Android SDK\android-sdk-windows-1.5_r1\tools>android list

D:\Android SDK\android-sdk-windows-1.5_r1\tools>android create avd –name aid15r1 –target 2

6. build module to APK

:cd ~/AndroidHome/src

:. build/envsetup.sh

:mmm packages/apps/Contacts/

p.s. however, if there is any import from another module in the current module, I still cannot build it successfully …

7. build your module in elipse

first of all, place your srource codes in packages/apps/YourModuleName/src

:cd /AndroidHome

:cp development/ide/eclipse/.classpath .

:chmod u+w .classpath

Now edit that copy of .classpath, if necessary.

in eclipse:

File > New > Java Project

enter your project name

Select “Create project from existing source”, enter the path to your Android root directory, and click Finish.

if it doesn’t start to build, uncheck and re-check Project > Build Automatically to force a rebuild

Project > Properties

Select “Java Build Path” from the left-hand menu.

Choose the “Source” tab.

Click “Add Folder…”.

Add your module’s “src” directory.

Click OK.

After the build success, the class file will be in out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes

p.s. I still don’t know how to build the apk file of my module in eclipse …

8. deal with devices/emulators

enter the device:

>adb shell

list directories/files:

#ls

system applications are mainly in /system/app/

install apk:

>adb install YourAPK.apk

installed apk will be placed in /data/local/tmp

push data into device:

>adb push test.txt /tmp/test.txt

** you cannot push apk files into /system/app/ on real device**

if you push files into /system/app/ on emulator, the following error may occur:

failed to copy ‘xxx.apk’ to ’system/app/xxx.apk’: Read-only file system

solution:

>adb remount

get data from device:

>adb pull /addroid/lib/libwebcore.so .

9. build the system image

:make snod

[References]

android.com/download

android-platform/browse_thread/thread/153e2155e33c6555

http://www.dubblogs.cc/roller/Android/entry/test

android/build.html

~richardlin/blog/?p=7

http://547600.javaeye.com/blog/368166

http://blog.chinaunix.net/u2/85805/showart_1897152.html

http://www.cppblog.com/kaisne/archive/2009/04/29/81493.html

android.com/using-eclipse

http://stenlyho.blogspot.com/2008/11/androidadb.html

android-developers@googlegroups.com/msg08828.html

http://blog.chinaunix.net/u2/86601/showart.php?id=1885062

http://blog.csdn.net/HKjinzhao/archive/2009/03/18/4002326.aspx

http://planet.nccucs.org/2008/09/04/678/

http://lotushy.blogspot.com/2008/10/android-sdk-developing-android.html

http://www.rankolife.cn/blog-280.html

http://forum.xda-developers.com/showthread.php?t=507244&page=42

http://blog.ring.idv.tw/comment.ser?i=252

android-framework/browse_thread/thread/7d43ce3cdbac35a8

android-platform/browse_thread/thread/de555a2f3029ab1a

張貼於

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值