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.5 G 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]
http://source.android .com/download
http://wenda.tianya.cn/wenda/thread?tid=267c01a129014d01&clk=wttpcts
http://www.rin.org.cn/2009/05/04/android_make/
http://groups.google.com/group/android -platform/browse_thread/thread/153e2155e33c6555
http://www.dubblogs.cc/roller/Android /entry/test
http://mmmyddd.freeshell.net/wiki/android /build.html
http://www.iim.nctu.edu.tw/~richardlin/blog/?p=7
http://bbase.mobi/mediawiki/intro/installing.html
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
http://stackoverflow.com/questions/560411/application-source-code-for-contactsandroid
http://source.android .com/using-eclipse
http://stenlyho.blogspot.com/2008/11/androidadb.html
http://www.mailinglistarchive.com/android -developers@googlegroups.com/msg08828.html
http://blog.chinaunix.net/u2/86601/showart.php?id=1885062
http://www.javaworld.com.tw/jute/post/view?bid=26&id=256165&tpg=1&ppg=1&sty=1#257795
http://blog.csdn.net/HKjinzhao/archive/2009/03/18/4002326.aspx
http://www.androidchina.org.cn/45.html
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
http://nsutt.wordpress.com/2009/02/
http://kuikui.javaeye.com/category/26593?show_full=true
http://groups.google.com/group/android -framework/browse_thread/thread/7d43ce3cdbac35a8
http://groups.google.com/group/android -platform/browse_thread/thread/de555a2f3029ab1a

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Mac下配置Android(安卓)NDK环境并搭建Coc
  2. 小胖加入Android(安卓)Fans的 大军了 呵
  3. 在android 下支持ntfs-3g
  4. Android内核开发:源码的版本与分支详解
  5. Android导出一个JAR库/Android如何将程序
  6. 3G Android智能手机视频预览万里
  7. Android的Activity屏幕切换动画||Gesture
  8. 有关Android线程的学习
  9. Android中sqlite数据库的简单使用
  10. Android之Http网络编程(三)