github meta/SoLoader v0.13.0

2 hours ago

Full Changelog: v0.12.1...v0.13.0

Breaking change

  • SoLoader.init(Context, ExternalSoMapping) no longer throws IOException, matching init(Context, boolean) (#135). Java code that catches IOException around this call must drop the catch to compile.

New APIs

  • SoLoader.appendSoSource(SoSource) adds a source after the existing ones, the counterpart of prependSoSource.
  • SoLoader.loadLibraryUnsafe(String) and loadLibraryUnsafe(String, int) behave like loadLibrary, for library names that are not constants. Keep loadLibrary for constant names, so build tools can see which libraries an app loads.
  • New init flags:
    • SOLOADER_ENABLE_DIRECT_SPLIT_SO_SOURCE: load libraries straight from split APKs, including ABI config splits (Android 5.0+).
    • SOLOADER_SYSTEM_SOSOURCE_ONLY: initialize only the system SoSource.
    • SOLOADER_ENABLE_SYSTEM_FALLBACK: fall back to System.loadLibrary() when a library is not in SoLoader's search paths.
    • SOLOADER_USE_DEVICE_PROTECTED_STORAGE_FOR_BACKUP_SOSOURCE: keep the backup SoSource in device-protected storage, so libraries load during Direct Boot (Android 7.0+).
    • SOLOADER_IMPLICIT_DEPENDENCIES: on Android 7.0+, the backup SoSource leaves a library's dependencies to the system linker.

Improvements

  • DirectApkSoSource searches the APK directory of the ABI the app was installed for first, then every other supported ABI (#155, fixes #154; #148). This fixes loading on x86_64 devices that run ARM libraries.
  • ABI detection reads ApplicationInfo.primaryCpuAbi, and falls back to the supported-ABI list when it cannot.
  • /system_ext/lib64 is now a default system library search path.
  • Split APKs: libraries can be registered per application split, including sideloaded splits, with one manifest per ABI.
  • The library dependency file (native_deps) is read through AssetManager.

Fixes

  • Android 17 (API 37): extracted libraries and their directory are now fully read-only, as System.load() requires.
  • Threads in one process that lock the same file now wait for each other instead of failing with OverlappingFileLockException.
  • NativeLoader no longer throws when two threads initialize it at the same time.
  • SystemLoadWrapperSoSource reports real load errors, such as missing symbols, instead of dropping them, and catches Throwable rather than only Exception.
  • Libraries are unpacked again when the app's /data/app/.../lib/arm directory is missing.

Diagnostics

  • MinElf load errors name the library and give its size.
  • SoLoader logs libraries loaded on the main thread, and its initialization logs are quieter.

Compatibility

  • Version checks for Android releases older than KitKat (API 19) were removed.
  • The DirectorySoSource denylist was removed.

Build

  • A Gradle build for the soloader AAR and the annotation and nativeloader JARs, checked in CI.

Don't miss a new SoLoader release

NewReleases is sending notifications on new releases.