[FIXED] Android Studio 4.2.2 Native dependencies in AARs buildFeatures.prefab=true – Missing argument "PACKAGE_PATH"


Android Studio 4.2.2

Adding Build Feature Prefab for Prefab AAR Shared Library Android.mk/CMake Build:


Following Documentation perfectly for Android Studio 4.1+ and using Build Features

android {
        buildToolsVersion '30.0.3'
        ndkVersion '22.1.7171670'
        buildFeatures {
            prefab true


Error while executing java process with main class com.google.prefab.cli.AppKt with arguments {--build-system ndk-build --platform android --abi armeabi-v7a --os-version 21 --stl c++_static --ndk-version 22 --output /Users/~var/Documents/project/.cxx/ndkBuild/debug/prefab/armeabi-v7a/prefab}

Usage: prefab [OPTIONS] [PACKAGE_PATH]...

Error: Missing argument "PACKAGE_PATH".

Error: Missing argument "PACKAGE_PATH".


When setting this:

buildFeatures {
        prefab true

You must then Link to an existing prefab published module after setting that command else this error occurs

If you are not using prefabs at all Remove this line and it will compile

OR either can Link to an Active Prefab via the Android.mk or CMakeLists


include $(CLEAR_VARS)
$(call import-add-path, $(LOCAL_PATH)/modulePath)
$(call import-add-path, /../../anotherModulePath)
# If you don't need your project to build with NDKs older than r21, you can omit
# this block.
ifneq ($(call ndk-major-at-least,21),true)
    $(call import-add-path,$(NDK_GRADLE_INJECTED_IMPORT_PATH))
# the linked prefab published module project location 
$(call import-module, openFrameworksAndroid)

If you need to build your module library with type of Prefab set the gradle setting buildFeatures.prefabPublishing true and configure these extra commands

// Enable generation of Prefab packages and include them in the library's AAR.
buildFeatures {
    prefabPublishing true

// Include the "mylibrary" module from the native build system in the AAR,
// and export the headers in src/main/cpp/include to its consumers
prefab {
    openFrameworksAndroid {
        //headers "src/main/cpp/include"

// Avoid packing the unnecessary libraries into final AAR. For details
// refer to https://issuetracker.google.com/issues/168777344#comment5
// Note that if your AAR also contains Java/Kotlin APIs, you should not
// exclude libraries that are used by those APIs.
packagingOptions {



More Documentation:


Answered By – Danoli3

Answer Checked By – Laura B. (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published