2016-05-24 4 views
1

私はpdfViewライブラリを追加した動作中のAndroidアプリケーションを持っています。アプリ内で追加機能を追加するライブラリを追加する際に、エミュレータ上で実行し、次のトレースで失敗したビルド:pdfviewライブラリを追加するとAndroidスタジオビルドに失敗しました

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 

以下は、私が行っている変更です: 1.私は、ファイルからのPDFlibライブラリが含まれている - >新規 - >インポートモジュール 2. ファイルにcompile project(':pdfLib')行を追加しました。 3.追加されたlibを使用して、いくつかの簡単なコードを追加しました。

はまた、実行時に次の例外を受け取っ:

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) 

これで私を助けてください。

UPDATE:

build.gradle:私はpdfviewでPDFを設定

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:[email protected]' 


} 

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> 

コード:

videoView.setVisibility(View.INVISIBLE); 
imageView.setVisibility(View.INVISIBLE); 
pdfView.setVisibility(View.VISIBLE); 
pdfView.fromFile(new File(mediaPath)).defaultPage(1).enableSwipe(false).load(); 
+0

layout.xmlの外観は? – hopeman

+0

オフラインで 'com.joanzapata.pdfview:android-pdfview:[email protected]'をダウンロードし、あなたのプロジェクトで 'Module'として設定してください。 –

+0

@AmitabhaBiswas - 同じことを試しても、同じエラーが残っています。あなたはこのライブラリで作業しましたか? – jay

答えて

1

ちょうどこれを試して、これはあなたの問題を解決します。あなたがライブラリにドキュメントを見れば

- Replace your compile project(':pdfLib') with 
    **'com.joanzapata.pdfview:android-pdfview:[email protected]'** 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. 
+0

はまだ同じ例外を持っています – jay

+0

show ur gradle file ..... –

+0

質問に追加、 – jay

0

は、それはそれはもはや維持されているVuDroid、のオフに基づいていると述べています。ライブラリ自体ももはや維持されていません。おそらくVuDroidが推奨されなくなった結果です。また、あなたが述べたようhere WebViewの中で、あなたのPDFを読み込むことができ

:私はあなたがまだのような維持されているライブラリを試すことを示唆しています。

+0

私はpdf用のオフラインビューアを使いたいので、webviewを使用しないでください。 droidreaderとapvのいくつかの実装例を指摘できますか? – jay

関連する問題