Error trying to loadLibrary for PDFTron Android

ぃ、小莉子 提交于 2019-12-04 17:33:57
Kush Patel

Import PDFTron Library Project in Android Studio. Use that Library Project in your application.For this use compile project(':libraries:PDFViewCtrlTools') in your application's build.gradle.

Now copy libPDFNetC.so file to "jni/libs/armeabi" folder in your application.

in your application.mk write this.

APP_ABI := armeabi-v7a
APP_CPPFLAGS += -std=c++11 -exception
APP_STL := gnustl_shared
APP_PLATFORM=android-19
APP_OPTIM := debug
NDK_TOOLCHAIN_VERSION := 4.8

in your Android.mk file add this

include $(CLEAR_VARS)
LOCAL_MODULE    := libPDFNetC
# this libs path is relative to my jni files, so, src/main/jni/libs/libPrecompiledLib.a
LOCAL_SRC_FILES := libs/armeabi/libPDFNetC.so
include $(PREBUILT_SHARED_LIBRARY)

Edit:

PDFDoc doc = PDFDoc(InputStream var1)

may be by using this method you can open PDF from url.

Code:

PDFViewCtrl mPDFViewCtrl = (PDFViewCtrl) view.findViewById(R.id.pdfViewer);
PDFDoc doc = new PDFDoc(filePath);
mPDFViewCtrl.setDoc(doc);

xml

<pdftron.PDF.PDFViewCtrl
    android:id="@+id/pdfViewer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="vertical|horizontal"
    android:visibility="gone"/>

If you are using standard jniLib structure (i.e. jniLibs in main as shown in your first screenshot), you don't need to specify it in sourceSets anymore. jniLibs.srcDirs = ['libs'] in sourceSets is conflicting with the standard structure (jniLibs).

See https://groups.google.com/forum/?fromgroups#!topicsearchin/pdfnet-sdk/android$20AND$20author$3Asgong@pdftron.com/pdfnet-sdk/0t_3-pN5jG4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!