构建纯AOSP时如何修改“ vendor / etc / public.libraries.txt”

时间:2019-01-17 11:25:24

标签: android android-ndk shared-libraries android-source

ENV AOSP (android-9.0.0_r20)的纯marlin target (PIXEL XL)

我想将自己的库libOwnlibrary.so添加到vendor/etc/public.libraries.txt白名单文件中,以便可以从自己的system/priv-app/MyOwnApp.apk APK中加载它

当前出现以下错误:

java.lang.UnsatisfiedLinkError: dlopen failed: library "/system/lib/libOwnlibrary.so" needed or dlopened by "/system/lib/libnativeloader.so" is not accessible for the namespace "classloader-namespace"

由于Android 7.0(API 24)引入的限制,这很有意义: https://developer.android.com/about/versions/nougat/android-7.0-changes#ndk

  

从Android 7.0开始,系统会阻止应用动态运行   链接到非NDK库,这可能会导致您的应用崩溃。

我当前的设置:

AOSP-root-folder/
    - vendor/
        - myvendor/
            device-partial.mk (this basically instructs `make` to copy libOwnlibrary.so to vendor/lib/libOwnlibrary.so
                    ```PRODUCT_COPY_FILES := .. .so```
            proprietary/
                Android.mk (pushes presigned prebuilt MyOwnApp.apk to /system/priv-app)
                    ```... include$(BUILD_PREBUILT)```

我应该更改/添加什么,以便能够修改vendor/etc/public.libaries.txt白名单文件以向其中添加libOwnlibrary.so

!!! 一种可行的方法是将libOwnlibrary.so添加到

AOSP-root-folder/system/core/rootdir/etc/public.libraries.android.txt

会在设备上转换为system/etc/public.libraries.txt

意味着将我的库从system/lib移到vendor/lib,并且我认为这是不允许的。 !!!

1 个答案:

答案 0 :(得分:0)

在device-partial.mk中添加一个步骤,以将您的库名称附加到现有文件vendor/etc/public.libaries.txt

此步骤后

device-partial.mk (this basically instructs `make` to copy libOwnlibrary.so to vendor/lib/libOwnlibrary.so
                    ```PRODUCT_COPY_FILES := .. .so```