Re: [android-building] How to add my prebuilt apk to sys.img

6,441 views
Skip to first unread message

Magnus Bäck

unread,
Nov 26, 2012, 2:41:41 PM11/26/12
to android-...@googlegroups.com
On Friday, November 23, 2012 at 03:38 EST,
Neil Jadhav <neil.j...@gmail.com> wrote:

> i've downloaded the source and successfully builded it.
> Now i want to add my apk file to the build.
> I've tried but failed.

It helps if you mention how far you've come.

> Plz help me with the steps to include my apk file to the build.

Add an Android.mk file to define your application and make sure it
gets built. Look at the files under packages/apps for inspiration.
The file shouldn't have to be larger than five to ten lines.

To have the application added to the system image, add the application
name to the PRODUCT_PACKAGES variable for your device (or any of the
higher-level configurations from which your device inherits, see e.g.
build/target/product/generic_no_telephony.mk).

To get the application installed just once (if you want to try things
out), a simple "make NameOfYourApp" will build a new system image with
your application included. That command assumes you have a fresh build
available.

--
Magnus Bäck
ba...@google.com

Jean-Baptiste Queru

unread,
Nov 26, 2012, 3:48:03 PM11/26/12
to android-...@googlegroups.com
Here's a quick example:

https://android.googlesource.com/device/samsung/toro/+/android-4.2_r1/self-extractors/samsung/staging/proprietary/Android.mk
shows how to set up the Android.mk, which tells the build system what
it needs to do in order to include a given module in a build. The
build system locates such files automagically.

https://android.googlesource.com/device/samsung/toro/+/android-4.2_r1/self-extractors/samsung/staging/device-partial.mk
shows how to tell the build system to include certain modules in the
build. Such a file needs to be included explicitly from your current
product configuration.

JBQ
> --
> 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



--
Jean-Baptiste M. "JBQ" Queru
Technical Lead, Android Open Source Project, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

Paul Beeler

unread,
Nov 26, 2012, 4:11:23 PM11/26/12
to android-...@googlegroups.com
I've successfully built my Wallpaperz app into aosp.  Here's how I do it.

I set up the Android.mk file as follows and put it in the same directory as the app:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := Wallpaperz
LOCAL_SRC_FILES := Wallpaperz.apk
LOCAL_MODULE_SUFFIX := .apk
LOCAL_MODULE_CLASS := APPS
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_MODULE_PATH := $(TARGET_OUT)/app
include $(BUILD_PREBUILT)

(I think this pretty much does the same thing as JBQ's example)

Then for device.mk I added the following:

PRODUCT_PACKAGES += \
    Wallpaperz

Paul Beeler

unread,
Mar 19, 2013, 6:56:47 PM3/19/13
to android-...@googlegroups.com

Martin the location of the app and and Android.mk is not important.  Just make sure they're in the same directory.  device.mk should be in your device tree of your device.

On Mar 19, 2013 4:31 PM, "Martin Espericueta" <espm...@gmail.com> wrote:
Sorry for resurrecting this question, but I've been trying to build a apk into aokp but it doesn't get built. Paul, what folders did you add the app/Android.mk into, and where did you place the device.mk file?
--
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Philippe Bellanger

unread,
Nov 9, 2015, 12:22:53 PM11/9/15
to Android Building
I have followed the instructions from you and JBQ above to include a Google prebuilt app in my marshmallow AOSP build, i.e.:
1. I created a directory in my vendor/manufacturer/device tree with the prebuilt apk and the Android.mk file
2. I added the PRODUCT_PACKAGES in my vendor/manufacturer/device/device-vendor.mk  (Note: My vendor/manufacturer/device/device-vendor.mk is included in my device/manufacturer/device/device.mk file)

Unfortunately, the apk does not show up in the system/app directory of my build after creating the AOSP build. When I make a full build, it completes without error (but without adding the prebuilt package in system/app). When I run the mmma command with my prebuilt apk folder as the argument, I get the following error message:
make: *** No rule to make target

Any idea why the apk does not show up in system/app?
Reply all
Reply to author
Forward
0 new messages