Switch to MuPDF Java API
Our C bridge to MuPDF is a pain to update whenever we update MuPDF, and also out of date (annotations, etc.)
I'm working on this (with #277) at https://github.com/sss/document-viewer/tree/switch-to-mupdf-java-api
I'm working on this (with #277) at https://github.com/sss/document-viewer/tree/switch-to-mupdf-java-api
I have tried this branch and I am getting:
More than one file was found with OS independent path 'lib/x86_64/libebookdroid.so'
also
More than one file was found with OS independent path 'lib/x86/libebookdroid.so'
More than one file was found with OS independent path 'lib/arm64-v8a/libebookdroid.so'
More than one file was found with OS independent path 'lib/armeabi-v7a/libebookdroid.so'
when doing:
./gradlew build
tried to exclude those 4 errors that I am encountering by following: You can add this in your Project/app/build.gradle inside android{}
packagingOptions {
exclude 'lib/x86_64/libebookdroid.so'
exclude 'lib/x86/libebookdroid.so'
exclude 'lib/arm64-v8a/libebookdroid.so'
exclude 'lib/armeabi-v7a/libebookdroid.so'
}
in the document-viewer/build.gradle but then opening any book will crash the app.
Did you manage to make it work with MuPDF v1.12, or it is still WIP?
The highlight and annotation feature added to MuPDF v1.12 is really really cool.
Tried to pickFirst the duplicated libraries:
packagingOptions {
pickFirst 'lib/x86_64/libebookdroid.so'
pickFirst 'lib/x86/libebookdroid.so'
pickFirst 'lib/arm64-v8a/libebookdroid.so'
pickFirst 'lib/armeabi-v7a/libebookdroid.so'
}
source: https://stackoverflow.com/a/48231124/1970830
But still crashed after opening a book:
2019-06-27 04:52:35.552 9743-9836/org.sufficientlysecure.viewer E/zygote: No implementation found for long org.ebookdroid.droids.mupdf.codec.MuPdfDocument.open(int, int, java.lang.String, java.lang.String) (tried Java_org_ebookdroid_droids_mupdf_codec_MuPdfDocument_open and Java_org_ebookdroid_droids_mupdf_codec_MuPdfDocument_open__IILjava_lang_String_2Ljava_lang_String_2)
2019-06-27 04:52:35.554 9743-9836/org.sufficientlysecure.viewer E/Document Viewer.ViewerActivityController.1: BookLoadTask.doInBackground(): Unexpected error
java.lang.UnsatisfiedLinkError: No implementation found for long org.ebookdroid.droids.mupdf.codec.MuPdfDocument.open(int, int, java.lang.String, java.lang.String) (tried Java_org_ebookdroid_droids_mupdf_codec_MuPdfDocument_open and Java_org_ebookdroid_droids_mupdf_codec_MuPdfDocument_open__IILjava_lang_String_2Ljava_lang_String_2)
at org.ebookdroid.droids.mupdf.codec.MuPdfDocument.open(Native Method)
at org.ebookdroid.droids.mupdf.codec.MuPdfDocument.<init>(MuPdfDocument.java:22)
at org.ebookdroid.droids.mupdf.codec.EpubContext.openDocument(EpubContext.java:10)
at org.ebookdroid.core.DecodeServiceBase.open(DecodeServiceBase.java:82)
at org.ebookdroid.core.models.DocumentModel.open(DocumentModel.java:84)
at org.ebookdroid.ui.viewer.ViewerActivityController$BookLoadTask.doInBackground(ViewerActivityController.java:1069)
at org.ebookdroid.ui.viewer.ViewerActivityController$BookLoadTask.doInBackground(ViewerActivityController.java:1045)
at org.emdev.ui.tasks.AsyncTask$1.call(AsyncTask.java:215)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
2019-06-27 04:52:35.864 1671-1684/? E/memtrack: Couldn't load memtrack module
I've added a branch mupdf_java. Pages are rendering but this is still WIP.
Some notes:
- ~~Zoom is broken~~
- Some interfaces are not implemented yet
- ~~outline~~
- ~~search~~
- ~~links~~
- ~~
nativeEraseColorerases everything in pdf page~~ (Edit: just realized that this is error handling) - ~~Crop does not work~~
- ~~authorization does not work~~
All done. I hope I didn't miss something. I'll merge it in dev.
If this means that it will be easier to maintain the project, that's great.
In the mean time, can a release be created/tagged?
I believe that the changes merged already warrant a new release...
It would be great to have a new version on f-droid, and even better if the version on Google Play would be fixed with the workaround for the crash with recent-ish versions of Android, so that I can recommend a very able PDF/djvu viewer to non-technical people like my parents.
I've updated F-Droid metadata. For some architectures build has failed. This seems to be a server issue. I guess we have to wait for server to retry the build.
As for Google Play version, AFIK it must be signed by the original submitter. @dschuermann can you upload https://github.com/SufficientlySecure/document-viewer/tree/v2.8.2 to Google play?