I am trying to fork AndroidPdfViewer to replace its underlying library from PdfiumAndroid to android-pdfium.
My problem is, when I load AndroidPdfViewer and PdfiumAndroid in Android Studio, I can't get the project to work, even before changing anything.
The problem is PdfiumAndroid has JNI code that define many previously declared functions, but the linker can't link the definitions in C++ to the declarations in Java. The error message has two errors:
E/barteksc.sample: No implementation found for long com.shockwave.pdfium.PdfiumCore.nativeOpenDocument(int, java.lang.String) (tried Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument and Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument__ILjava_lang_String_2)
E/PDFView: load pdf error
java.lang.UnsatisfiedLinkError: No implementation found for long com.shockwave.pdfium.PdfiumCore.nativeOpenDocument(int, java.lang.String) (tried Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument and Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument__ILjava_lang_String_2)
at com.shockwave.pdfium.PdfiumCore.nativeOpenDocument(Native Method)
at com.shockwave.pdfium.PdfiumCore.newDocument(PdfiumCore.java:135)
Here is the gradle file. It looks like there is something missing, although these are the original files before any modifications.
I tried to add this to proguard-rules.pro
-keep class com.shockwave.** { *; }
it removed the first error, but the second is still there.
Solved it.
If anyone is having the same issue, I did the following to solve it:
That created what I was said about in my question
It looks like there is something missing
That created a libs folder that has the necessary definitions for the linker.