[英]Compiling an Android package from Google git repo
I am trying to get a specific package (Launcher2) from the google git repo and compile it. 我正在尝试从google git存储库中获取特定的程序包(Launcher2)并进行编译。 Planning on changing a few things and create a custom one.
计划更改一些内容并创建自定义的内容。 After installing git i used this to get the source from the tag of the 2.2 sdk:
安装git后,我用它来从2.2 sdk的标签中获取源代码:
git clone https://android.googlesource.com/platform/packages/apps/Launcher2 launcher2
git checkout android-sdk-2.2_r2
After all done and the files exist, I am creating a new android project in eclipse and choosing the 2.2 target framework and marking the "use existing source". 完成所有操作并存在文件之后,我将在eclipse中创建一个新的android项目,然后选择2.2目标框架并标记“使用现有源代码”。 The project is opening but with many compilation errors like invalid imports and unrecognized fields and so on ... It looks like the source I have does not match the framework.
该项目正在开放中,但存在许多编译错误,例如无效的导入和无法识别的字段等等。看来我拥有的源与框架不匹配。 What am I missing?
我想念什么?
Ahhh... But you do know if you have the entire repo and the device tree in place, that you can build just one package. 嗯...但是您确实知道是否有完整的存储库和设备树,您只可以构建一个软件包。 Assume for a moment, that your environment is Linux based and that your device handset is a Samsung i9000 (Galaxy S), then in your source tree you would have device/samsung/galaxys , which contains proprietary libraries and extra code related only specifically to the hardware for the Samsung i9000.
假设您的环境是基于Linux的,并且您的手机是Samsung i9000(Galaxy S),那么在您的源代码树中,您将拥有device / samsung / galaxys ,其中包含专有库和仅与以下内容相关的额外代码三星i9000的硬件。
Then its a matter of having to do this as a once-off operation - 然后,必须将其作为一次性操作进行操作-
. build/envsetup.sh
lunch
Pick Samsung Galaxy s from the lunch menu. 从午餐菜单中选择Samsung Galaxy s。 This is the tricky bit in ensuring your device handset appears on the lunch menu!
这是确保您的设备听筒出现在午餐菜单上的棘手问题!
make -jX
(Replace X with the appropriate number of cores your processor has) (用适当数量的处理器核替换X)
Your entire system.img/boot.img would be deposited in out/target/product/samsung/galaxys after a couple of hours depending on how fast your machine/environment is. 几个小时后,您的整个system.img / boot.img将存放在out / target / product / samsung / galaxys中 ,具体取决于您的机器/环境的速度。
Now, to build one package you simply enter this: 现在,要构建一个软件包,只需输入以下内容:
make Launcher2
Now you will have a new android app called Launcher.apk that will be deposited in out/target/product/samsung/galaxys/system/app directory. 现在,您将拥有一个名为Launcher.apk的新Android应用程序,该应用程序将存放在out / target / product / samsung / galaxys / system / app目录中。
How? 怎么样?
Simple, when after doing a ' lunch ', and invoke this command 很简单,当做完“ 午餐 ”之后,调用此命令
make modules > modules_list.txt
The resulting output will contain the names of modules in that file modules_list.txt , that can be built on the command line - modules in the context of the entire AOSP source tree, it can be a (static|shared) library, native executable or even Android Java app. 结果输出将包含该文件modules_list.txt中的模块名称,该文件可以在命令行上构建-在整个AOSP源树的上下文中的模块,它可以是(静态|共享)库,本机可执行文件或甚至Android Java应用。
Now, do not bother cleaning out the entire out/ tree (even though that can swallow up a lot of space), leave that in there to speed up the build process of individual modules. 现在,不必费心清理整个输出/树(即使这会占用很多空间),而要留在那里以加快单个模块的构建过程。
If you really really want to delete them, issue this: 如果您确实要删除它们,请发出以下命令:
make clean && make clobber
and the entire out/ directory is removed and gone for good. 整个out /目录将被删除并永久消失。
if you want to compile in Eclipse, you will not be able. 如果要在Eclipse中进行编译,将无法执行。 Because it uses internal classes (com.android.internal.*) and private APIs.
因为它使用内部类(com.android.internal。*)和专用API。
See Launcher 1 (until android 2.1) : http://code.google.com/p/android-launcher-for-sdk/ 请参阅启动器1(直到android 2.1): http : //code.google.com/p/android-launcher-for-sdk/
Otherwise, you can have a look on the source code of ADW Launcher 2 which is based on Launcher2. 否则,您可以查看基于Launcher2的ADW Launcher 2的源代码。 You will see the modification made to be compliant with the public APIs
您将看到所做的修改以符合公共API
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.