Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android.bp and ninja: error: unknown target

I have an application in packages/apps under my vendor dir in Android O. The application relies on a HIDL interface, which is added as a java library.

If I build the app with Android.mk file, it builds just fine. If I build the app with Android.bp file, hiding the Android.mk, it doesn't build and fails with an error:

ninja: error: unknown target 'MODULES-IN-vendor-${vendor_name}-apps-${app_name}', did you mean 'MODULES-IN-vendor-${vendor_name}-apps-${another_app_name}'?

Or it can be just

ninja: error: unknown target 'MODULES-IN-vendor-${vendor_name}-apps-${app_name}'

My Android.bp looks like:

android_app {

    java_libs: ["some.hidl.lib-V1.0-java"],

    java_static_libs: ["android.hidl.base-V1.0-java-static"],

    srcs: ["**/*.java"],

    android_resource_dirs: ["res/**"],

    name: "MyApplication",

    module_name: "MyApplication",

    package_name: "me.myself.MyApplication", // also tried just the name as it is done in Android.mk

    enabled: true,

    proguard_enabled: disabled

}

Any ideas?

like image 335
Vitalii Dmitriev Avatar asked Oct 18 '22 03:10

Vitalii Dmitriev


1 Answers

Not sure if you have resolved this issue, I also met such issue. This is caused by Android only tries to include the "Android.bp" file from the level 3 folder which is defined in "Android.bp" under root folder:

optional_subdirs = [
    ....
    "vendor/*/*",
]

So you need to add one "Android.bp" into vendor/vendor_name/packages with specified optional_subdirs or just wildcard as above.

like image 182
Stanley Lei Avatar answered Nov 11 '22 12:11

Stanley Lei