android源码编译,模块编译
2012-04-16 15:02
225 查看
本文内容大部分来自 /article/4688793.html
Android 源码编译按照官方网站所说去做即可。
安装java需要
The line you have to add to your /etc/apt/sources.list is:
http://source.android.com/source
编译模块
android中的一个应用程序可以单独编译,编译后要重新生成system.img
在源码目录下执行1 $ . 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.
我们可以使用mmm来编译指定目录的模块,如编译联系人:1 $ mmm packages/apps/Contacts/
编完之后生成两个文件:
out/target/product/generic/data/app/ContactsTests.apk
out/target/product/generic/system/app/Contacts.apk
可以使用
$ make snod
重新生成system.img,再运行模拟器
$make sdk
注意,这里需要的javadoc版本为1.5,所以你需要在步骤1中同时安装sun-java5-jdk。这个现在新的source应该不需要了。
$ make sdk
$ source build/envsetup.sh
//需要,不然会有 couldn't locate source file的一些错误。
$ lunch sdk-eng
$ make sdk
编译很慢。编译后生成的SDK存放在out/host/linux-x86/sdk/,此目录下有android-sdk_eng.xxx_linux- x86.zip和android-sdk_eng.xxx_linux-x86目录。android-sdk_eng.xxx_linux-x86就是 SDK目录
实际上,当用mmm命令编译模块时,一样会把SDK的输出文件清除,因此,最好把android-sdk_eng.xxx_linux-x86移出来
此后的应用开发,就在该SDK上进行,所以把7)对于~/.bashrc的修改注释掉,增加如下一行:
1 export PATH=${PATH}:~/android/out/host/linux-x86/sdk/android-sdk_eng.xxx_linux-x86/tools
关于环境变量、android工具的选择
目前的android工具有:
A、我们从网上下载的SDK,如果你下载过的话( tools下有许多android工具,lib/images下有img映像)
B、我们用make sdk编译出来的SDK( tools下也有许多android工具,lib/images下有img映像)
C、我们用make编译出来的out目录( tools下也有许多android工具,lib/images下有img映像)
那么我们应该用那些工具和img呢?
首先,我们一般不会用A选项的工具和img,因为一般来说它比较旧,也源码不同步。其次,也不会用C选项的工具和img,因为这些工具和img没有经过 SDK的归类处理,会有工具和配置找不到的情况;事实上,make sdk产生的很多工具和img,在make编译出来out目录的时候,已经编译产生了,make sdk只是做了copy而已。
e)安装、配置ADT
略过;
f)创建Android Virtual Device
编译出来的SDK是没有AVD(Android Virtual Device)的,我们可以通过android工具查看:1$ android list
创建AVD:1 $ android create avd -t 1 -n myavd
可以android –help来查看上面命令选项的用法。创建中有一些选项,默认就行了
再执行android list,可以看到AVD存放的位置
以后每次运行emulator都要加-avd myavd或@myavd选项:1 $ emulator -avd myavd
编译kernel,请参考 http://source.android.com/source/building-kernels.html
Android 源码编译按照官方网站所说去做即可。
安装java需要
The line you have to add to your /etc/apt/sources.list is:
deb http://us.archive.ubuntu.com/ubuntu/ hardy multivers
http://source.android.com/source
编译模块
android中的一个应用程序可以单独编译,编译后要重新生成system.img
在源码目录下执行1 $ . 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.
我们可以使用mmm来编译指定目录的模块,如编译联系人:1 $ mmm packages/apps/Contacts/
编完之后生成两个文件:
out/target/product/generic/data/app/ContactsTests.apk
out/target/product/generic/system/app/Contacts.apk
可以使用
$ make snod
重新生成system.img,再运行模拟器
$make sdk
注意,这里需要的javadoc版本为1.5,所以你需要在步骤1中同时安装sun-java5-jdk。这个现在新的source应该不需要了。
$ make sdk
$ source build/envsetup.sh
//需要,不然会有 couldn't locate source file的一些错误。
$ lunch sdk-eng
$ make sdk
编译很慢。编译后生成的SDK存放在out/host/linux-x86/sdk/,此目录下有android-sdk_eng.xxx_linux- x86.zip和android-sdk_eng.xxx_linux-x86目录。android-sdk_eng.xxx_linux-x86就是 SDK目录
实际上,当用mmm命令编译模块时,一样会把SDK的输出文件清除,因此,最好把android-sdk_eng.xxx_linux-x86移出来
此后的应用开发,就在该SDK上进行,所以把7)对于~/.bashrc的修改注释掉,增加如下一行:
1 export PATH=${PATH}:~/android/out/host/linux-x86/sdk/android-sdk_eng.xxx_linux-x86/tools
关于环境变量、android工具的选择
目前的android工具有:
A、我们从网上下载的SDK,如果你下载过的话( tools下有许多android工具,lib/images下有img映像)
B、我们用make sdk编译出来的SDK( tools下也有许多android工具,lib/images下有img映像)
C、我们用make编译出来的out目录( tools下也有许多android工具,lib/images下有img映像)
那么我们应该用那些工具和img呢?
首先,我们一般不会用A选项的工具和img,因为一般来说它比较旧,也源码不同步。其次,也不会用C选项的工具和img,因为这些工具和img没有经过 SDK的归类处理,会有工具和配置找不到的情况;事实上,make sdk产生的很多工具和img,在make编译出来out目录的时候,已经编译产生了,make sdk只是做了copy而已。
e)安装、配置ADT
略过;
f)创建Android Virtual Device
编译出来的SDK是没有AVD(Android Virtual Device)的,我们可以通过android工具查看:1$ android list
创建AVD:1 $ android create avd -t 1 -n myavd
可以android –help来查看上面命令选项的用法。创建中有一些选项,默认就行了
再执行android list,可以看到AVD存放的位置
以后每次运行emulator都要加-avd myavd或@myavd选项:1 $ emulator -avd myavd
编译kernel,请参考 http://source.android.com/source/building-kernels.html
相关文章推荐
- android源码模块单独编译方案
- Android源码中的模块编译及Android.mk文件语法
- 关于如何在Android源码目录中建立自己的C工程,并用mm命令单独进行该C工程模块的编译,以及Android.mk的使用介绍(2)
- 模块编译Android源码方法
- 单独编译Android源码的模块。
- Android源码mm模块编译 & mm编译apk
- 关于Android源码中编译C模块的错误
- android源码环境内置已编译好的模块apk_so_jar_bin
- 在android源码编译自己的模块
- Android源码编译指定模块的三种方法
- Android源码开发中单个模块的编译自动化
- Android之源码之模块编译调试
- 编译Android源码以及单个模块的编译
- 【转】模块编译Android源码方法
- android源码环境下用mmm/mm编译模块,输出编译log到文件的方法
- 如何编译Android源码的单独模块
- 关于如何在Android源码目录中建立自己的C工程,并用mm命令单独进行该C工程模块的编译,以及Android.mk的使用介绍(1)
- Android源码编译之模块编译
- 将Android源码导入eclipse中的方法以及编译Android源码指定模块