androidapkandroid-10.0android-make

Does Android.mk require AndroidManifest.xml?


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)


Solution

  • 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.