Ubuntu Linux (i386)
To set up your Linux development environment, make sure you have the following:
* Git 1.5.4 or newer and the GNU Privacy Guard.
$ sudo apt-get install git-core gnupg
* JDK 5.0, update 12 or higher.
$ sudo apt-get install sun-java6-jdk
* The following packages: flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev (optional), build-essential, zip, curl.
$ sudo apt-get install flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
* You might also want Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds overflows, etc.
$ sudo apt-get install valgrind
* Intrepid (8.10) users may need a newer version of libreadline:
$ sudo apt-get install lib32readline5-dev
Ubuntu Linux (amd64)
This has not been as well tested. Please send success or failure reports to repo-discuss@googlegroups.com.
The Android build requires a 32-bit build environment as well as some other tools:
* Git, JDK, flex, and the other packages as listed above in the i386 instructions:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl
* Get a 32-bit version of the JVM:
$ sudo apt-get install sun-java6-jdk # JDK tools (javac, etc)
$ sudo apt-get install ia32-sun-java6-bin # JRE (java itself)
$ sudo update-java-alternatives -s ia32-java-6-sun
* Pieces from the 32-bit cross-building environment:
$ sudo apt-get install lib32z1-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs
* Intrepid (8.10) users may need a newer version of libreadline:
$ sudo apt-get install lib32readline5-dev
* X11:
o Ubuntu doesn't have packages for the X11 libraries, but that can be worked around with the following command:
$ sudo ln -s /usr/lib32/libX11.so.6 /usr/lib32/libX11.so
o If the build fails because of missing X11/Xlib.h and X11/Xatom.h, install the X11 devel packages. (This problem exists when building on Ubuntu 8.10 x86_64)
sudo apt-get install x11proto-core-dev # provides Xatom.h
sudo apt-get install libx11-dev # provides Xlib.h
我的是 ubuntu 8.10 64位版本
现执行了64位的一些安装后好像还在出错主要应该是 缺这一步把 具体不知道了
$ sudo apt-get install valgrind
环境设置好开始下载源码了
Installing Repo
Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see Using Repo and Git.
To install, initialize, and configure Repo, follow these steps:
1. Make sure you have a ~/bin directory in your home directory, and check to be sure that this bin directory is in your path:
$ cd ~
$ mkdir bin
$ echo $PATH
2. Download the repo script and make sure it is executable:
$ curl >~/bin/repo 《-在后面主服务器老出错把网址改为 android3.git...
$ chmod a+x ~/bin/repo
Initializing a Repo client
1. Create an empty directory to hold your working files:
$ mkdir mydroid
$ cd mydroid
2. Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest:
$ repo init -u git://android.git.kernel.org/platform/manifest.git
* If you would like to check out a branch other than "master", specify it with -b, like:
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake
3. When prompted, configure Repo with your real name and email address. If you plan to submit code, use an email address that is associated with a Google account.
A successful initialization will end with a message such as
repo initialized in /mydroid
Your client directory should now contain a .repo directory where files such as the manifest will be kept.
What will my name and email be used for?
To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account (which does not have to be a Gmail address). Make sure this is a live address at which you can receive messages. The real name that you provide here will show up in attributions for your code submissions.
What is a manifest file?
The Android source files are divided among a number of different repositories. A manifest file contains a mapping of where the files from these repositories will be placed within your working directory when you synchronize your files.
Getting the files
To pull down files to your working directory from the repositories as specified in the default manifest, run
$ repo sync
For more about repo sync and other Repo commands, see Using Repo and Git.
The Android source files will be located in your working directory under their project names.
Building the code
To build the files, run make from within your working directory:
$ cd ~/mydroid
$ make
基本上没啥问题
编译完后在 out 目录生成了我们需要的 .image文件
为啥需要杂用,就郁闷了
后来网上看到一个哥们说的文章
说可以直接在这里 make sdk的 就有使用工具了
摘原文:
make 最后会生成system.img。看到mail list里有人问这个干嘛用,其实是文档里没有完全写清楚。一般来说,我想普通人还需要的是make sdk这一步,会在myandroid/out/host/YOUR_OS/sdk中生成sdk。和从google官方下载下来的sdk差不多,可以直接运行了
在进行过一次完整的make后,以后对一些程序的修改,大可不必重新make sdk,因为make sdk实在太慢了。
先在myandroid目录下执行
$ . build/envsetup.sh
然后你就会多出几个可用的命令。在改了Contacts项目后,可以简单的执行mmm packages/apps/Contacts/来单独编译这个部分。为了可以直接测试改动,需要生成新的system.img,在myandroid目录下执行
make snod即可 当然,如果你改动的是emulator或者其它外围相关的,而非系统内部的东西,就不只是要重新生成system.img了
make sdk
出现下列错误:
SDK buildinfo: out/target/product/generic/sdk/sdk-build.prop
Docs droiddoc: out/target/common/docs/dx
javadoc: 错误 - 在 doclet 类 DroidDoc 中,方法 start 已抛出异常 java.lang.reflect.InvocationTargetException
com.sun.tools.javac.code.Symbol$CompletionFailure: 未找到 sun.util.resources.OpenListResourceBundle 的类文件
1 错误
make: *** [out/target/common/docs/dx-timestamp] 错误 45
song@song-laptop:~/mydroid$
把java6降级到java5
sudo apt-get install sun-java5-jdk
In Ubuntu you can run
sudo update-alternatives --config javadoc
把 javadoc 设置为java5版本
make sdk
emulator -help
export PATH="/home/song/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/song/bin:/home/song/mydroid/out/host/linux-x86/sdk/android-sdk_eng.song_linux-x86/tools"
执行 emulator 出错
generic$ emulator -image system.img -initdata userdata.img -ramdisk ramdisk.img
emulator: ERROR: you must provide the name of a virtual machine to start the emulator.
please see -help-vm for details.
走到下面目录
song@song-laptop:~/mydroid/out/host/linux-x86/sdk/android-sdk_eng.song_linux-x86/tools$ ./android --create --target 1 --name myconfig
Android 1.5 is a basic Android platform.
Do you which to create a custom hardware profile [no]
Created VM 'myconfig' based on Android 1.5
generic$ emulator -vm myconfig -image system.img -initdata userdata.img -ramdisk ramdisk.img
直接用 JF1。3 RC30 的rom 工具 fastboot 写入到我手机上 如果弄坏了就完蛋了!愿主保佑!
步骤如下:
关闭手机,
同时按住 测边照相键 + 开机键
进入到显示3个小人画面
然后直接按开机键旁边的返回键 直到显示 fastboot
连接数据线
电脑端执行
fastboot devices #显示设备
fastboot flash system system.img
fastboot flash userdata userdata.img
fastboot reboot #重启
重启进入后发现 WI-FI不能用
声音没用
配置eclipse 根据说明文档有点不解
Enter eclipse
Basic setup
First, it's important to make sure the regular Android development system is set up.
cd /path/to/android/root # 这个路径我去哪找阿 ! 半天才反应过来 就算 android源码路径
make # and wait a while, if you haven't done this 这个我已经make了
Important: You will still be using "make" to build the files you will actually run (in the emulator or on a device). You will be using Eclipse to edit files and verify that they compile, but when you want to run something you will need to make sure files are saved in Eclipse and run "make" in a shell. The Eclipse build is just for error checking.
Eclipse needs a list of directories to search for Java files. This is called the "Java Build Path" and can be set with the .classpath file. We have a sample version to start you off.
cd /path/to/android/root
cp development/ide/eclipse/.classpath .
chmod u+w .classpath # Make the copy writable
Now edit that copy of .classpath, if necessary.
Increase Eclipse's Memory Settings
The Android project is large enough that Eclipse's Java VM sometimes runs out of memory while compiling it. Avoid this problem by editing the the eclipse.ini file. On Apple OSX the eclipse.ini file is located at /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini
这里我是 ubuntu 所以我的eclipse路径是 sudo gedit /usr/lib/eclipse/eclipse.ini
Memory-related defaults (as of Eclipse 3.4)
-Xms40m
-Xmx256m
-XX:MaxPermSize=256m
Recommended settings for Android development
-Xms128m
-Xmx512m
-XX:MaxPermSize=256m
These settings set Eclipse's minimum Java heap size to 128MB, set the maximum Java heap size to 512MB, and keep the maximum permanent generation size at the default of 256MB.
继续。。。。
配置 ddms遇到问题 因为我的是64位操作系统 google 论坛中找到一项说明
复制 ddms 为 ddms64
编辑 ddms64 第72行 把java 路径改为 java_cmd="/usr/lib/jvm/ia32-java-6-sun/bin/java"