Monday, 28 December 2020

lib folder missing when installing APK

I would like to know how to build my APK so that my libraries are installed/copied under /data/data/<package name>/lib when installing the APK.

  • I am using Android Studio 4.0.1

  • I build an APK and confirm when I extract it that I have a lib/arm64-v8a folder that contains my jni libs.

  • I want that after I install my APK, some other applications on the same device can access the libs that I have in the lib/arm64-v8a. The /data/data/<package name> folder seems to be the right place for this, hence my question; if there is another approach for making my libraries accessible on device, I am open to it.

  • I set android.bundle.enableUncompressedNativeLibs=false in my gradle.properties file based on this discussion even though I didn't see any effect using it with true or false.

  • I set android:extractNativeLibs="true" in my Manifest

However, when I adb install my apk, the /data/data/<package name>/ folder on my device only contains a cache and code_cache folder, both of which are empty.

I do see under /data/app/ a folder with my libraries but they include strings that are randomly set each time I install the APK:

/data/app/~~sFE8-eNknFAkhKJ-1S03lg==/<package name>-rsDLNgpi4vult7yVBrPNOQ==/
   base.apk
   lib/arm64/
       <my .so in there>

These random strings prevent me from accessing reliably my libraries from any other application. (If there is a way to not have these random strings as part of the name and /data/app is the recommended location for my libraries to be shared with other applications, I am interested in that alternate approach.)

I have also installed other prebuilt APK and with these, I do see the libraries under /data/data/<package name>/lib like I want. This to me indicates that my issue is related to how I build my APK with AS 4.0.1, not to my device, its Android version, or how I install the APK.



from lib folder missing when installing APK

No comments:

Post a Comment