kotlin-toolkit: Conflict on libc++_shared.so between liblcp and PDFiumAndroid
It looks like there’s a conflict between the latest version of PDFiumAndroid 1.9.0 and liblcp. When building, I get this error:
More than one file was found with OS independent path “lib/arm64-v8a/libc++_shared.so”
I managed to build by adding these settings in the build.gradle
of the app:
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}
But then, the LCP lib crashes with this error:
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__sfp_handle_exceptions" referenced by "/data/app/org.readium.reader-9khTthf02oLgGERC1SDuCQ==/lib/arm64/liblcp.so"...
at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1667)
at org.readium.lcp.sdk.Lcp.<clinit>(Lcp.kt:32)
at org.readium.r2.lcp.license.LicenseValidation$isProduction$1.invoke(LicenseValidation.kt:118)
However, it works with an older version of PDFiumAndroid, so now we’re stuck with PDFiumAndroid 1.6.1 (instead of 1.9.0) and AndroidPdfViewer 2.8.2 (instead of 3.2.0).
Any help is most welcome.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 15 (13 by maintainers)
Another repository that is being maintained (for now, fingers crossed) is https://github.com/mhiew/PdfiumAndroid and https://github.com/mhiew/AndroidPdfViewer. I tried their latest versions (PDFium 1.9.2 and AndroidPdfViewer 3.2.0-beta.3) in the toolkit here along with LCP and it worked. I did have to add
jniLibs.pickFirsts.add
though, which isn’t good.Per @cursem it sounds like liblcp and PDFium need to be compiled using the same NDK version to avoid the
2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs
error? Not even sure where to find the NDK version that is used. Trying to find the conversation in Slack but not having any luck.