0

I am trying to build my app as a part of the AOSP and realized that the Android.mk file does not take the path of the AndroidManifest.xml as input.

How can the mm command build the app with just the java files and the resources?

From where does the Android make get the information contained in AndroidManifest.xml?

Note:

Currently, my app is building with mm but has a smaller size (1MB vs 5MB) and does not show up on the device after adb install. Maybe this will fix it.

My Android.mk file for any reference

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

LOCAL_STATIC_ANDROID_LIBRARIES += \
    android-arch-lifecycle-extensions \
    android-support-v7-recyclerview \
    android-support-v7-appcompat \
    android-support-constraint-layout \

# Build all java files in the java subdirectory
#LOCAL_SRC_FILES := $(call all-subdir-java-files)
#Commented line just made a ~17kB apk file
LOCAL_SRC_FILES := $(call all-java-files-under, app/src/main/java)
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/app/src/main/res

# Name of the APK to build
LOCAL_PACKAGE_NAME := LocalPackage

LOCAL_SDK_VERSION := current
#Otherwise build failing

# Tell it to build an APK
include $(BUILD_PACKAGE)

zeitgeist
  • 852
  • 12
  • 19
  • AndroidManifest.xml is needed for an android app (e.g. an installable .apk). Android.mk is used to build an NDK binary (e.g. a C-language android shared library). Apples and Oranges... – FoggyDay Aug 10 '21 at 05:39
  • I am using `Android.mk` to build a system app. It is built along with the device binary. – zeitgeist Aug 10 '21 at 05:47
  • I tried putting `Android.mk` in the same directory as `AndroidManifest.xml` and the manifest reflected inside the built apk. For more details follow https://stackoverflow.com/questions/68711139/apk-built-using-android-mk-mm-command-not-running-in-device-after-install – zeitgeist Aug 12 '21 at 02:56

1 Answers1

0

Android.mk for an apk requires AndroidManifest.xml. Android.mk for a NDK binary does not require AndroidManifest.xml.

The Android make gets the information contained in AndroidManifest.xml automatically if the AndroidManifest.xml is in the same path as the Android.mk.

I verified this by putting Android.mk in the same directory as AndroidManifest.xml and the manifest reflected inside the built apk.

For more details follow APK built using Android.mk mm command not running in device after install.

zeitgeist
  • 852
  • 12
  • 19