Fercho_27
Fercho_27

Reputation: 31

How to update a local Shared Library for compatibility with Android 15 16KB Devices?

We're using the Ananas library in our app. Following the official documentation to test the Ananas demo in an Android 15 Emulator with a 16-KB based system image, we found the app getting stuck (no crash) when applying a filter to edit an image, the app is stuck loading and the Logcat shows the following line:

2025-01-14 19:27:52.368 16574-18462 nativeloader            io....amutkarshtiwari.ananasproject  D  Load /data/app/~~K2DsRcC_nLSnacu1r-e0kA==/io.github.iamutkarshtiwari.ananasproject-Sla3ZLIGIN1Ma-aDhtc6TA==/lib/x86_64/libphotoprocessing.so using ns clns-7 from class loader (caller=/data/app/~~K2DsRcC_nLSnacu1r-e0kA==/io.github.iamutkarshtiwari.ananasproject-Sla3ZLIGIN1Ma-aDhtc6TA==/base.apk!classes2.dex): dlopen failed: empty/missing DT_HASH/DT_GNU_HASH in "/data/app/~~K2DsRcC_nLSnacu1r-e0kA==/io.github.iamutkarshtiwari.ananasproject-Sla3ZLIGIN1Ma-aDhtc6TA==/lib/x86_64/libphotoprocessing.so" (new hash type from the future?)

Testing with a Emulator Pixel 8a API 35 with image system-images/android-35/google_apis_playstore_ps16k/x86_64/. If we test with Emulator Pixel 7 API 35 system-images/android-35/google_apis_playstore/x86_64/ it works perfectly, evidently the issue is due to 16KB compatibility.

We have:

externalNativeBuild {
   ndkBuild {
      path file('jni/Android.mk')
   }
}
~/Library/Android/sdk/ndk/27.2.12479018/ndk-build -C /MY_PROJECT_PATH/Ananas/ananas clean
~/Library/Android/sdk/ndk/27.2.12479018/ndk-build -C /MY_PROJECT_PATH/Ananas/ananas

But it still doesn't work. Running the check_elf_alignment.sh script from the docs on the project's APK shows the library is still "Unaligned".

-e /var/folders/22/7bl_jpq137l883cghrfhxzt80000gn/T/app-debug_out_XXXXX.DA2PVl6sGv/lib/x86_64/libphotoprocessing.so: \e[31mUNALIGNED\e[0m (2**12)

Any help would be greatly appreciated! I realize the library has been archived, so the only options are figuring out this problem for future compatibility or finding a different library...

UPDATE: I made the following changes

After compiling project, filters now work in the Demo app using the same Android 15 16KB Emulator as stated before. Running ELF script shows x86_64 as Aligned now -e /var/folders/22/7bl_jpq137l883cghrfhxzt80000gn/T/app-debug_out_XXXXX.wQrETumTaI/lib/x86_64/libphotoprocessing.so: \e[32mALIGNED\e[0m (2**14) and running readelf for .so file shows all LOAD rows Align columns as 0x4000

Upvotes: 0

Views: 74

Answers (0)

Related Questions