16

I have a custom rom based on AOSP and I am working on a system app that is packaged during the rom build just like any other system app.

Is it possible to switch this app to a gradle style app and build that specific app with gradle during the AOSP build? i.e. - Start the gradle build from a makefile?

Distwo
  • 11,569
  • 8
  • 42
  • 65

1 Answers1

12

I didn't find a perfect solution for this. But you can try:

Android.mk:

LOCAL_PATH := $(call my-dir)
$(info $(shell ($(LOCAL_PATH)/gradlew build -p $(LOCAL_PATH)/)) )
$(info $(shell ($(LOCAL_PATH)/finalize.sh $(PRODUCT_OUT))))

finallize.sh:

BASEDIR=$(dirname $0)
PRODUCT_PATH=$1
echo $PRODUCT_PATH
java -Xmx1024m -jar $BASEDIR/../../../out/host/linux-x86/framework/signapk.jar $BASEDIR/../../../build/target/product/security/platform.x509.pem $BASEDIR/../../../build/target/product/security/platform.pk8 $BASEDIR/main/build/outputs/apk/main-normal-release-unsigned.apk $PRODUCT_PATH/system/app/MYAPP.apk

It worked for me

skoperst
  • 2,259
  • 1
  • 23
  • 35
  • 2
    This script runs when including the android.mk file, and I have my suspicions that this is the incorrect time for it to run (compared to when an app using BUILD_PACKAGE will be built). – Cameron Martin Jul 06 '16 at 15:45
  • 3
    is there any better solution by now? – phoebus Feb 07 '18 at 21:33
  • @phoebus No, no any better solution, I wasted half day to find a better solution, e.g. find a script tool to convert the gradle building files to Android.mk, but I fail, so the current answer is: NO. – Clock ZHONG Nov 21 '20 at 15:37