I'm evaluating PSPDFKit for one of my Android app. To create a new document I'm using following code:
final File outputFile = new File(getFilesDir(), "new-document.pdf");
final PSPDFProcessorTask task = new PSPDFProcessorTask(NewPage.patternPage(NewPage.PAGE_SIZE_A4, PagePattern.LINES_7MM).build());
PSPDFProcessor.processDocument(task, outputFile);
The app crashes with following exception on the second statement above;
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ammar.app.pdftest, PID: 7588
java.lang.UnsatisfiedLinkError: No implementation found for com.pspdfkit.framework.jni.NativeLicense com.pspdfkit.framework.jni.NativeLicense.license() (tried Java_com_pspdfkit_framework_jni_NativeLicense_license and Java_com_pspdfkit_framework_jni_NativeLicense_license__)
at com.pspdfkit.framework.jni.NativeLicense.license(Native Method)
at com.pspdfkit.framework.cz.e(SourceFile:111)
at com.pspdfkit.document.processor.PSPDFProcessorTask.addNewPage(SourceFile:299)
at com.pspdfkit.document.processor.PSPDFProcessorTask.<init>(SourceFile:111)
at com.ammar.app.pdftest.MainActivity$1.onClick(MainActivity.java:38)
at android.view.View.performClick(View.java:4856)
at android.view.View$PerformClick.run(View.java:19956)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:211)
at android.app.ActivityThread.main(ActivityThread.java:5389)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
I've tried re-fetching all the dependencies but this crash is not going away.
This exception is generated when the native library for the PSPDFKit SDK is missing/not copied in correctly as part of your setup, or if you have not properly initialized PSPDFKit.
To initialize PSPDFKit use this line of code, preferably inside your
Application#onCreate
method or during activity startup.Please closely follow our integration guide and use Gradle: https://pspdfkit.com/guides/android/current/getting-started/integrating-pspdfkit/
For further help please follow up on the ticket you submitted via our internal support system - happy to help you over there: https://pspdfkit.com/support/request