Cannot use Readium SDK on Android prior to 4.3 (API version 18)
Atryamie opened this issue · 3 comments
Hi,
We use the SDK readium to read book, and tried to update it to the last version 0.27.0. but we get 2 issues with the NDK.
First one will be fixed in the 0.28.0 version (965fbb6) regarding the NDK version.
The second one is regarding the Shared lib : gnustl on devices prior to 4.3. Google explain here (https://developer.android.com/ndk/guides/cpp-support.html) that devices using API prior to 18 (some readers still use 4.2 -> API 17) must include manually all the shared library. In Readium we only include epub3.so, meaning that the library doesn't find the shared lib when it try to load epub.so.
This issue is a Bug
Expected Behaviour
Open book with readium
Observed behaviour
Crash with error message :
myApp E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at myApp.sdk.dataService.Service.OpenBookService.getOpenBookIntent(OpenBookService.java:63)
[...]
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libgnustl_shared.so" needed by "libepub3.so"; caused by load_library(linker.cpp:745): library "libgnustl_shared.so" not found
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:521)
at org.readium.sdk.android.EPub3.<clinit>(EPub3.java:45)
Steps to reproduce
- Use the app on device with Android 4.2
- Try to read a book
Product
- Native application (Readium SDK C++)
- Running on in-house app
- Android 4.2
Additional information
Test to fix it with success and no side-effect detected so far :
Add before this line : https://github.com/readium/readium-sdk/blob/develop/Platform/Android/lib/src/main/java/org/readium/sdk/android/EPub3.java#L44
this :
System.loadLibrary("gnustl_shared");
Thanks for sharing this!
The ReadiumSDK (in the broad sense, including readium-shared-js) does not officially support Android < 4.4 (KitKat with modern browser engine), but I guess the risk of regression bugs because of the suggested addition of System.loadLibrary("gnustl_shared");
is pretty low?
@danielweck Yes because it only replace the autoload available in newer version that allow system to autoload both static and dynamics librairies.
Loading manually this lib should not include any bugs, Android should prevent multi-load automatically.
Kind,
Thank you for the clarifications!