问题
I am trying to build an Android application inside of AOSP.
I have defined the Android.bp
file as follows
cc_prebuilt_library_shared {
name: "libPrintString",
target: {
android_arm: {
srcs: ["lib/libPrintString.so"],
},
android_arm64: {
srcs: ["lib64/libPrintString.so"],
},
},
strip: { none:true, },
}
java_import {
name: "stringutils",
jars: ["libs/stringutils.jar"],
}
android_app {
name: "HelloWorld",
srcs: ["src/**/*.java",],
platform_apis: true,
product_specific: true,
certificate: "platform",
privileged: true,
static_libs: [
"com.google.android.material_material",
"androidx-constraintlayout_constraintlayout",
"stringutils",
],
jni_libs: ["libPrintString"]
}
I have put my application in the /packages/apps
folder, the project has the following structure
+ HelloWorld
- Android.bp
- AndroidManifest.xml
+ lib
- libPrintString.so
+ lib64
- libPrintString.so
+ libs
- stringutils.jar
+ res
+ src
When I am calling make I am getting an error
FAILED: ninja: 'out/target/product/mydroid/product/lib64/libPrintString.so', needed by 'out/target/product/mydroid/product.img', missing and no known rule to make it
Can someone please help me to find a solution?
回答1:
After long fights with the build system, I finally found a solution and wrote a small article to describe in details how to build an application with system privileges
How to Build an Android Application with System Privilegies
I still did not fully understand why it was not working in the beginning, most probably because somehow my build system was not cleaning old libraries, but now everything is working correctly.
来源:https://stackoverflow.com/questions/65718113/aosp-building-application-with-jni-libs