# How to add prebuilt apk's to build?



## mbroeders

Well, thanks to a lot of help and very useful topics here, I've come a long way. I now know how to build a pre-rooted rom. However, for my own convenience (I don't plan on releasing this) I would like to have my Gapps build in as well. But my attempt have been very frustrating so far. I really hope someone can help me out. What I've tried so far:

1) I've put my gapps in the appropriate folders in /vendor/mark/proprietary/..

2) In the /device/samsung/maguro/full-maguro.mk file I added some line (for convenience I'll only use a few apps)


Code:


<br />
PRODUCT_COPY_FILES += \<br />
    vendor/mark/proprietary/app/Superuser.apk:system/app/Superuser.apk \<br />
    vendor/mark/proprietary/app/CalendarGoogle.apk:system/app/CalendarGoogle.apk \<br />
	vendor/mark/proprietary/app/ChromeBookmarksSyncAdapter.apk:system/app/ChromeBookmarksSyncAdapter.apk \<br />
    etc etc etc<br />

This gave me an error complaining about prebuilt apk's, so:

3) I changed the PRODUCT_COPY_FILES to BUILT_PREBUILT


Code:


<br />
BUILT_PREBUILD += \<br />
    vendor/mark/proprietary/app/Superuser.apk:system/app/Superuser.apk \<br />
    vendor/mark/proprietary/app/CalendarGoogle.apk:system/app/CalendarGoogle.apk \<br />
	vendor/mark/proprietary/app/ChromeBookmarksSyncAdapter.apk:system/app/ChromeBookmarksSyncAdapter.apk \<br />
    etc etc etc<br />

Unfortunately, this did not work either and just gave me a whole bunch of errors.

4) I tried several other small things, none of which worked. Finally I commented out a few lines in the /build/core/Makefile:


Code:


<br />
<br />
#define check-product-copy-files<br />
#$(if $(filter %.apk, $(1)),$(error \<br />
#    Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!))<br />
#endef<br />

Strangely enough, when I tried this only with the Superuser.apk it succeeded, however, when I added the other apk's it again did not work.

Well, I really don't know what to try next. I think it should be possible, but I just cannot find a solution. Any help would be appreciated!


----------



## nocoast

http://rootzwiki.com/topic/14293-aosp-build-with-no-baseband-cdma-galaxy-nexus/

Read that whole thread. Everything jbird says is true and doug and I have a bit of adivce in there too...


----------



## mbroeders

nocoast said:


> http://rootzwiki.com...a-galaxy-nexus/
> 
> Read that whole thread. Everything jbird says is true and doug and I have a bit of adivce in there too...


Yeah, that has been one of the most useful threads for me, but I cannot find anywhere how to add prebuilt apk's. The su and busybox binaries (as are all the other libs) are copied correctly, but apk's give an error.


----------



## nocoast

sry different thread check this post out.


----------



## jdkoreclipse

Use PRODUCT_COPY_FILES, however you have to mod the /build/core/Makfile to support it.

Sent from my Galaxy Nexus using RootzWiki


----------



## mbroeders

Thanks all. It still doesn't work, so I customized the flashable gapps package to fit my needs. That'll work as well.

Just one more small question, in a different thread JBirdVegas wrote:



> I've been asked this question before so this may help
> check out the device/*/*/*.mk files, lets call this our device's make file (ie device/motorola/droid2.mk), this is where you include the SuperUser app , su binary and busybox binary (of course you can include it from anywhere, usually root stuff is in common.mk files, but this is easiest for our example).


Does this mean I have to add a couple of lines to the full_maguro.mk file (in my case) or can I create a custom .mk file? And if so, will this custom .mk automatically be included in the build or do I have to alter other files as well? Thanks.


----------



## JBirdVegas

mbroeders said:


> Does this mean I have to add a couple of lines to the full_maguro.mk file (in my case) or can I create a custom .mk file? And if so, will this custom .mk automatically be included in the build or do I have to alter other files as well? Thanks.


of coarse you can say you have mark.mk you would just have to add


Code:


$(call inherit-product-if-exists, device/SomeCompany/SomeDevice/mark.mk)

using the -if-exists method won't stop the build if it can't find mark.mk

to be sure your build includes your Makefile or it will kill the build use


Code:


$(call inherit-product, device/SomeCompany/SomeDevice/mark.mk)


----------

