Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using an app bundle I get UnsatisfiedLinkError for <1% of users

I'm trying to use the new Android App Bundles.

I run some test locally on my devices, and everything works correctly. However, once deployed to production, I am starting to see a few errors like this:

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/xyz/base.apk"],nativeLibraryDirectories=[/data/app/xyz/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libsqlite3x.so"
java.lang.Runtime.loadLibrary (Runtime.java)
java.lang.System.loadLibrary (System.java)
io.requery.android.database.sqlite.SQLiteDatabase.<clinit> (SQLiteDatabase.java:86)
io.requery.android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked (SQLiteOpenHelper.java:241)
io.requery.android.database.sqlite.SQLiteOpenHelper.getReadableDatabase (SQLiteOpenHelper.java:199)
...

The error states that a library I'm using (requery/sqlite-android) cannot find the .so file that it needs. This seems strange, since I checked with bundletool, and in every APK the file .so is there.

The error happens on two devices: a Samsung Galaxy Note 7 and a TECNO-J8, running Android 6 and 5 respectively.

According to the Play Store, the error happens for app installed through Google Play, so I doubt the error is related to APK sideloading.


The generated APK bundle includes splits for the following architectures:

  • splits\base-armeabi_v7a.apk
  • splits\base-mips.apk
  • splits\base-arm64_v8a.apk
  • splits\base-x86_64.apk
  • splits\base-x86.apk

Do you have any hints?

like image 384
Spotlight Avatar asked Oct 01 '18 16:10

Spotlight


1 Answers

This issue might be related to https://issuetracker.google.com/issues/127691101

It happens on some devices of LG or old Samsung devices where the user has moved the app to the SD Card.

One way of fixing the issue is to use Relinker library to load your native libraries instead of directly calling System.load method.

https://github.com/KeepSafe/ReLinker

Another way is to block the movement of the app to the SD card or by keeping android.bundle.enableUncompressedNativeLibs=false in your gradle.properties file.

like image 132
shubhamgarg1 Avatar answered Nov 23 '22 09:11

shubhamgarg1