Search code examples
javaandroidmakefileandroid-ndkandroid-source

How to resolve so file mapping in eclipse project aosp android


I am working in aosp 9 where I migrated the entire Browser app from 6 to 9.

I have librawrapper.so which is available in jni/armv7-a/ folder. This project is eclipse and hence I am not able to edit in gradle. So it has only mk file.

 LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

SODIR=armv7-a

LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_TAGS := optional

LOCAL_PRELINK_MODULE := false

LOCAL_MODULE    := librawrapper.so
LOCAL_SRC_FILES := $(SODIR)/librawrapper.so
LOCAL_SHARED_LIBRARIES := libcutils

include $(BUILD_PREBUILT)

When I use mm command, i can see this in Install: out/target/product/sabresd_6dq/system/lib/librawrapper.so

But when I use whole build using make command, build is successful but when I click the browser icon, it crashes and when I checked the log system/lib folder turns empty and it throws error that,

   java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/system/app/Browser/Browser.apk"],nativeLibraryDirectories=[/system/app/Browser/lib/arm, /system/lib, /vendor/lib, /system/lib, /vendor/lib]]] couldn't find "librawrapper.so"

May I know how to resolve this error? Is it possible to add or modify in mk file to enable the ndk or properly making to map in system/lib folder?


Solution

  • Found solution:

    Go to build/target/product/core_minimal.mk

    Add this line:

     PRODUCT_COPY_FILES += \
        frameworks/native/data/etc/android.software.webview.xml:system/etc/permissions/android.software.webview.xml \
            frameworks/native/cmds/librawrapper.so:system/lib/librawrapper.so
    

    Also you need to add the librawrapper.so in frameworks/native/cmds/

    Then compile it. It will push that into system/lib/