设为首页 加入收藏

TOP

Android SDK 源代码编译
2014-11-24 07:48:47 来源: 作者: 【 】 浏览:0
Tags:Android SDK 源代码 编译

1. 环境


sudo apt-get install git-core


sudo apt-get install curl


sudo apt-get install zlib -dev 变为 sudo apt-get install zlib1g -dev


sudo apt-get install bison


sudo apt-get install flex


sudo apt-get install libncurses-dev (libncurses5-dev)


sudo apt-get install g++


sudo apt-get install libx11-dev


sudo apt-get install gperf


安装Java6


关于Java版本:Java6能够编译代码,但不能生成文档,最好准备两套Java环境


Ubuntu 10.04 64-bit


sudo apt-get install libc6-dev-i386


sudo apt-get install lib32ncurses5-dev


sudo apt-get install libx11-dev


sudo apt-get install g++-multilib


sudo apt-get install lib32z1-dev


64-bit Java6


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


chmod a+x ~/bin/repo


获取eclair代码:


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


从Android 2.2开始,编译SDK需要64位系统,32位的,只好先编译Eclair了.


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


repo sync


3. 编译


make


cd eclair


. ./build/envsetup.sh


make sdk


最后,同步这些变化:
$ source ~/.bashrc
$ cd ~/android/out/target/product/generic
$ emulator -system system.img -data userdata.img -ramdisk ramdisk.img
最后进入android桌面,就说明成功了。


4. 编译模块


android中的一个应用程序可以单独编译,编译后要重新生成system.img
在源码目录下执行
$ . build/envsetup.sh (.后面有空格)
就多出一些命令:
- croot: Changes directory to the top of the tree.
- m: Makes from the top of the tree.
- mm: Builds all of the modules in the current directory.
- mmm: Builds all of the modules in the supplied directories.
- cgrep: Greps on all local C/C++ files.
- jgrep: Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- godir: Go to the directory containing a file.
可以加—help查看用法
我们可以使用mmm来编译指定目录的模块,如编译联系人:
$ mmm packages/apps/Contacts/
编完之后生成两个文件:
out/target/product/generic/data/app/ContactsTests.apk
out/target/product/generic/system/app/


5. 直接执行make是不包括make sdk的。make sdk用来生成SDK,这样,我们就可以用与源码同步的SDK来开发android


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Windows Socket和Linux Socket编.. 下一篇Linux系统下DSO同名全局变量浅析

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·JAVA现在的就业环境 (2025-12-26 01:19:24)
·最好的java反编译工 (2025-12-26 01:19:21)
·预测一下2025年Java (2025-12-26 01:19:19)
·Libevent C++ 高并发 (2025-12-26 00:49:30)
·C++ dll 设计接口时 (2025-12-26 00:49:28)