简体   繁体   English

如何使用Android源代码编译Helloworld

[英]How to compile Helloworld with Android source code

I wanted to run a helloworld application with the AOSP and see it in emulator. 我想用AOSP运行helloworld应用程序,并在模拟器中看到它。 [ Not through Android SDK setup] [不通过Android SDK设置]

I followed the steps in http://source.android.com/source/download.html and compiled successfully the full code from / directory. 我按照http://source.android.com/source/download.html中的步骤进行操作,并成功从/目录编译了完整代码。

I could see contacts.apk, camera.apk all applications apk in ~/mydroid/out/target/product/generic/system/app. 我可以在〜/ mydroid / out / target / product / generic / system / app中看到contacts.apk,camera.apk所有应用程序apk。

I tried two things. 我尝试了两件事。

1 - Went to /package/apps folder. 1-转到/ package / apps文件夹。 Took a helloworld application( helloworld folder which was created in android-sdk), and copied a 'Android.mk' file from Launcher2 folder, kept my new name for application and placed the folder in packages/app folder and compiled at /. 拿了一个helloworld应用程序(在android-sdk中创建的helloworld文件夹),并从Launcher2文件夹中复制了一个“ Android.mk”文件,保留了应用程序的新名称,并将该文件夹放置在packages / app文件夹中,并在/编译。 I couldnt see .apk file created for ~/mydroid/out/target/product/generic/system/app. 我看不到为〜/ mydroid / out / target / product / generic / system / app创建的.apk文件。

2 - I changed the package name for Launcher2 in packages/app folder in 'Android,mk' file and compiled at root. 2-我在'Android,mk'文件的packages / app文件夹中更改了Launcher2的软件包名称,并在根目录下进行了编译。 I couldnt see a new apk created on the new packaged name under ~/mydroid/out/target/product/generic/system/app. 我看不到在〜/ mydroid / out / target / product / generic / system / app下的新打包名称上创建的新apk。

I tried several times with changes in activity names, application names in manifest.xml file. 我尝试了几次更改活动名称和manifest.xml文件中的应用程序名称。 Nothing reflects.But it is sure, both helloworld, and change in package name is getting picked up while compiling. 没有反应,但是可以肯定的是,helloworld和程序包名称的更改在编译时都会被拾取。 I could see intermediate classes getting created. 我可以看到创建了中间类。 ~/mydroid/out/target/common/obj/APPS/manifirst_intermediates/src/com/android/mani --> manifirst is like a helloworld which i created and run. 〜/ mydroid / out / target / common / obj / APPS / manifirst_intermediates / src / com / android / mani-> manifirst就像是我创建并运行的helloworld。 ~/mydroid/out/target/common/obj/APPS/Launcher2_intermediates/src/com/android/launcher 〜/ mydroid / out / target / common / obj / APPS / Launcher2_intermediates / src / com / android / launcher

Could anyone please share the steps of compiling a simple Helloworld program in AOSP.? 谁能分享在AOSP中编译简单的Helloworld程序的步骤?

Thanks, Mani 谢谢,玛尼

Copy Android.mk from any other package and just have to change the LOCAL_PACKAGE_NAME and make that one match the folder name in packages/apps. 从任何其他程序包中复制Android.mk ,只需更改LOCAL_PACKAGE_NAME ,并使该程序与程序包/应用程序中的文件夹名称匹配。

Also, add your package in the list in /build/target/product/core.mk 另外,将您的软件包添加到/build/target/product/core.mk的列表中

After compiling you should find the apk where you expect it... (out/target/product/.../system/app) 编译后,您应该在期望的位置找到apk ...(输出/目标/产品/.../系统/应用程序)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM