2

I'm trying to learn how to compile an app in android source. The app is just a simple hello world application. I followed instructions from Making an app in the Android Source compile into system/app instead of data/app? and a couple of other sources. But when I make the application the apk file is written to obj/APPS with suffix intermediates instead of system/app and fails to show up in the emulator when I boot up. Please find below the Android.mk file.

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := tests 

LOCAL_MODULE_PATH := system/app

LOCAL_UNINSTALLABLE_MODULE := true

LOCAL_SDK_VERSION := current

LOCAL_PACKAGE_NAME := MyApplication

LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-gridlayout
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v13
LOCAL_STATIC_JAVA_LIBRARIES += android-support-design

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_RESOURCE_DIR += prebuilts/sdk/current/support/v7/appcompat/res
LOCAL_RESOURCE_DIR += prebuilts/sdk/current/support/v7/gridlayout/res
LOCAL_RESOURCE_DIR += prebuilts/sdk/current/support/design/res

LOCAL_CERTIFICATE := platform

LOCAL_AAPT_FLAGS := --auto-add-overlay
LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.appcompat:android.support.v7.gridlayout

include $(BUILD_PACKAGE)
##################################################
include $(CLEAR_VARS)

include $(BUILD_MULTI_PREBUILT)

# Use the following include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))

I make the application by going to the application directory in packages/apps and doing 'mm'. Is there anything I'm missing here?

Community
  • 1
  • 1
blessonm
  • 71
  • 5
  • 12

3 Answers3

0

Find out the BoardConfig.mk and add this :

PRODUCT_PACKAGES += MyApplication

AOSP build system will build every Android.mk, but only packages defined in BoardConfig will be put into the final product path.

0

you have to add the app module into the PRODUCT_PACKAGE from the devices/"your preferred vendor"/"device_name"/aosp_"device Name".mk file

It should look something like the following

$(call inherit-product, device/lge/hammerhead/full_hammerhead.mk)

PRODUCT_NAME := aosp_hammerhead

PRODUCT_PACKAGES += \
        Launcher3 \
    MyApplication \
Abdullah
  • 935
  • 9
  • 18
0

It has little bit changed. Aosp checks /device/"vendor"/"your_device"/"your_platform"/base.mk file for compiling and /device/"vendor"/"your_device"/common/base.mk for installing apk to /out/target/product/"your_device/system/app/" You should add your app name to both files. In my case; aosp/device/qcom/qssi/base.mk to compile, aosp/device/qcom/common/base.mk to install output(apk) to /out/target/product/msm8953/system/app/

akor
  • 11
  • 1