Reputation: 31
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:
targetSdkVersion
and compileSdk
to 34, updated AGP to 8.6.0 and resolved compilation errors.ndkVersion = "27.2.12479018"
in Gradle.externalNativeBuild {
ndkBuild {
path file('jni/Android.mk')
}
}
libphotoprocessing.so
Library using the following commands (and updated the native code to resolve compilation errors):~/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
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true
in Application.mk
per the docs.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
LOCAL_CFLAGS
from Android.mk and set in ndkBuild block of build.gradle cFlags "-DANDROID_NDK -DDISABLE_IMPORTGL -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
APP_ABI := arm64-v8a armeabi-v7a riscv64 x86 x86_64
in Application.mk and abiFilters 'arm64-v8a', 'armeabi-v7a', 'riscv64', 'x86', 'x86_64'
in ndkBuild block~/Library/Android/sdk/ndk/27.2.12479018/ndk-build -C /MY_PROJECT_PATH/Ananas/ananas clean
and ~/Library/Android/sdk/ndk/27.2.12479018/ndk-build -C /MY_PROJECT_PATH/Ananas/ananas -B V=1 NDK_LOG=1
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