Open mickael-menu opened 4 years ago
@danielweck Do you have any idea if there's something that could be done on the liblcp side to address this problem? Thanks
I think, more likely something @aferditamuriqi can help with, because Android. I am only familiar with the NodeJS and plain UNIX LCP native lib builds.
See Slack discussion for further analysis of the LCP build issue
According to @danielweck , this pull request could address a similar issue: https://github.com/readium/readium-lcp-client/pull/49
Gradle tweaks to “pick” native lib dependency … but cannot remember the exact pattern
I think you meant https://github.com/readium/SDKLauncher-Android/pull/152/files
Alternatively, maybe some inspiration in this PR, but I doubt so https://github.com/readium/SDKLauncher-Android/pull/147/files
it’s been a long time since I rewrote the Gradles to integrate ReadiumSDK and ReadiumLCP (Readium1) for Android build matrix ARM/x86 32/64 release/debug … I do not remember all the techniques in the PR (…I imagine the Gradle / NDK syntax evolved since then)
@mickael-menu Hi, Have you solved this problem?
@cursem No, I didn't spend more time on this. Let us know if you tackle this.
@cursem No, I didn't spend more time on this. Let us know if you tackle this.
You should make sure compile liblcp and PDFiumAndroid with the same ndk version.
I tried again upgrading AndroidPdfViewer and liblcp doesn't seem to crash anymore, after adding the following in the build.gradle
:
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'
}
It could have been fixed after upgrading to Gradle 7, but will need more testing to make sure there's no issue on older Android versions.
So bad news, the above fix failed with a different build of liblcp
(another app).
I found an alternative though, which is to force the downgrade of pdfium-android
. This doesn't seem to cause any issue with AndroidPdfViewer and doesn't conflict anymore with liblcp
.
implementation("com.github.barteksc:pdfium-android:1.8.2") {
force = true
}
@mickael-menu i'll be looking into the lcp libs, it's probably time to upgrade them. Will discuss with @llemeurfr
Good to know, thanks!
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.
It looks like there's a conflict between the latest version of PDFiumAndroid 1.9.0 and liblcp. When building, I get this error:
I managed to build by adding these settings in the
build.gradle
of the app:But then, the LCP lib crashes with this error:
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.