Reputation: 2032
I have a working android application to which I have added pdfView library. Upon adding the library adding additional functionality within the app and run on emulator, build failed with following trace:
12:02:39 PM Executing tasks: [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
12:03:58 PM Gradle build finished with 1440 error(s) in 1m 18s 260ms
Following are the changes I have done:
1. I have included pdflib library from File -> New -> Import module
2. Added line compile project(':pdfLib')
to build.gradle
file.
3. Added some trivial code around using the added lib.
Also received the following exception during runtime:
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load vudroid from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/app.com.blynq.player-2.apk"],nativeLibraryDirectories=[/data/app-lib/app.com.blynq.player-2, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:355)
at java.lang.System.loadLibrary(System.java:525)
at org.vudroid.core.VuDroidLibraryLoader.load(VuDroidLibraryLoader.java:13)
at org.vudroid.pdfdroid.codec.PdfContext.<clinit>(PdfContext.java:13)
at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:50)
at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:31)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
Please help me with this.
UPDATE:
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "app.com.blynq.player"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile files('libs/jackson-annotations-2.7.4.jar')
compile files('libs/jackson-core-2.7.4.jar')
compile files('libs/jackson-databind-2.7.4.jar')
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile files('libs/universal-image-loader-1.9.5.jar')
compile files('libs/jpedal_lgpl.jar')
compile 'com.joanzapata.pdfview:android-pdfview:1.0.4@aar'
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="app.com.blynq.player.MainActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/imageView"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:src="@drawable/blynq_logo"
/>
<VideoView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/videoView"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:visibility="invisible"
/>
<com.joanzapata.pdfview.PDFView
android:id="@+id/pdfView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"/>
</FrameLayout>
Code where I set pdf in pdfview:
videoView.setVisibility(View.INVISIBLE);
imageView.setVisibility(View.INVISIBLE);
pdfView.setVisibility(View.VISIBLE);
pdfView.fromFile(new File(mediaPath)).defaultPage(1).enableSwipe(false).load();
Upvotes: 1
Views: 836
Reputation: 2828
If you look at the documentation to the library it says that it is based off of VuDroid, which is no longer maintained. The library itself is also no longer maintained; probably as a result of the VuDroid becoming deprecated. I would suggest that you try a library that is still being maintained such as:
Alternatively you could load your PDF in a WebView as described here.
Upvotes: 0
Reputation:
just try this , this will solve your issue.
- Replace your compile project(':pdfLib') with
**'com.joanzapata.pdfview:android-pdfview:1.0.4@aar'** or whatever library you want to add, because adding this type a library, it is
download the library at run time and build the gradle
properly,because adding library manually may occur some path issues
etc.
Upvotes: 1