AOSP building application with jni libs

泪湿孤枕 提交于 2021-02-07 10:29:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!