I want to add a custom application to the aosp source tree

131 views
Skip to first unread message

Christian Bauer

unread,
Oct 18, 2021, 5:19:44 PM10/18/21
to Android Building
I want to write an application to select different wallpapers and boot animations for OEM branding. This application should become part of the android system image. Once the branding has been chosen the application should no longer be started when booting the image.

On this way I wanted to proceed step by step.

But already at the first step I fail.

This first step is a simple HelloWorld java application.

I was building the android sources by lunching the target aosp_x86_64-eng.

I added the source files for the application in directory aosp/vendor/<CompanyName>/packages/app/HelloWorld" with both an "Android.mk" and a "AndroidManifest.xml" file.

But I couldn't figure out where to add the HelloWorld application in the build tree so that it becomes part of the image.

Is there a rule I can follow where to put the link to the application?


abhi...@gmail.com

unread,
Oct 19, 2021, 7:10:20 PM10/19/21
to Android Building
Hi, you need to add your app name to PRODUCT_PACKAGES so that the your app will be built.

For eg: 
If the name of your application is defined like below 
             LOCAL_MODULE := SampleApp
then add it to PRODUCT_PACKAGES like
       PRODUCT_PACKAGES += SampleApp

If your not sure where to put this flag then just add this in your app's Android.mk
       LOCAL_PATH:= $(call my-dir)
and at the end of this file add
       include $(call all-makefiles-under, $(LOCAL_PATH)

Then create a mk file with your app name itself (sampleapp.mk) in the same directory and add the PRODUCT_PACKAGES flag in it. Thats it.
Happy learning.

pakr pan

unread,
Oct 20, 2021, 3:07:32 AM10/20/21
to android-...@googlegroups.com
Hi Christian,

I suggest rather use Android.bp file than Android.mk file and you have to use something like this, which is more readable than using Android.mk


android_app {
name: "SampleApp",
srcs: [
"src/**/*.java",
],
optimize: {
enabled: false,
},
}

PS : .bp is blueprint extension ,which is used now by Soong Build system to generate AOSP build

Regards
Pankaj


--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/b0eafce6-ac2a-4871-a30f-33b5db819dd4n%40googlegroups.com.

Christian Bauer

unread,
Oct 21, 2021, 4:19:11 PM10/21/21
to Android Building

in fact I already had my application added to “build/make/target/product/aosp_product.mk”. But I got an error when building the source tree.

The error message was:

FAILED:

Build/make/core/artifact_path_requirements.mk:26: warning: build/make/target/product/sdk_phone_x86_64.mk produces files inside build/make/target/product/generic_system.mks artifact path requirement.

Offending entries:

System/priv-app/<AppName>/<AppName>.apk

My first idea was that “aosp_product.mk” is the wrong file and I have to add the make file for my app somewhere else.

Because of your answers I digged deeper into log files and did some googling.

Finally I found the reason for the error. I had to add

LOCAL_PRODUCT_MODULE := true

to the make file of my app. Now the apk is installed in “system/priv-app” folder.

@pan

Yes, I also think that moving to bp files would be a better solution. I will give this a try. After I got my branding app working.
Reply all
Reply to author
Forward
0 new messages