Vitalii Dmitriev
Vitalii Dmitriev

Reputation: 809

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?

Upvotes: 5

Views: 24808

Answers (2)

Jitendra
Jitendra

Reputation: 1115

In my case, I was using Android.mk file only but by mistake I used arm64 in

LOCAL_MODULE_TARGET_ARCH := arm64

But I was building for x86_64 target. So I changed to

LOCAL_MODULE_TARGET_ARCH := x86_64

And I worked. Might be this answer is not directly related to it but If someone would have done same mistake then it would help.

Upvotes: 0

Stanley Lei
Stanley Lei

Reputation: 35

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.

Upvotes: 3

Related Questions