Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android.view.InflateException: Binary XML file line #9: Error inflating class com.github.barteksc.pdfviewer.PDFView #84

Closed
akshay-shah opened this issue Aug 30, 2016 · 13 comments

Comments

@akshay-shah
Copy link

stackTrace:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.justswipe.document/com.justswipe.document.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class com.github.barteksc.pdfviewer.PDFView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2309)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.access$800(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5258)
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:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.github.barteksc.pdfviewer.PDFView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.justswipe.document.MainActivity.onCreate(MainActivity.java:33)
at android.app.Activity.performCreate(Activity.java:5979)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.access$800(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5258)
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:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.justswipe.document.MainActivity.onCreate(MainActivity.java:33)
at android.app.Activity.performCreate(Activity.java:5979)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.access$800(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5258)
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:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/priv-app/app-release.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]] couldn't find "libmodpdfium.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:989)
at com.shockwave.pdfium.PdfiumCore.(PdfiumCore.java:19)
at com.github.barteksc.pdfviewer.PDFView.(PDFView.java:316)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.justswipe.document.MainActivity.onCreate(MainActivity.java:33)
at android.app.Activity.performCreate(Activity.java:5979)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.access$800(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5258)
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:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

Below is the xml file where i use the library

<com.github.barteksc.pdfviewer.PDFView
    android:id="@+id/pdfView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="20dp" />

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerInParent="true"
    android:layout_margin="3dp"
    android:text="/" />
@MiguelAngelBrav
Copy link

Hola:

Tu problema es causado porque la librería no esta cargando una dependencia llamada "libmodpdfium.so"... esta librería es una dependencia, de una dependencia.

Cuando agregas "com.github.barteksc:android-pdf-viewer:2.1.0" a tu proyecto, este agrega internamente su dependencia "com.github.barteksc:pdfium-android:1.4.0", este ultimo tiene por dependencias dos archivos SO:

  • libjniPdfium.so
  • libmodpdfium.so

Revisa si Grandle descargo estas dependencias en la siguiente ruta:

  • app/build/intermediates/exploded-aar/com.github.barteksc/android-pdf-viewer
  • app/build/intermediates/exploded-aar/com.github.barteksc/pdfium-android

Los archivos SO están en la siguiente ruta:

  • app/build/intermediates/exploded-aar/com.github.barteksc/pdfium-android/1.4.0/jni

Saludos
Miguel Angel Bravo

@barteksc barteksc closed this as completed Jan 4, 2017
@siavashsoleymani
Copy link

i have this problem too but can you please describe your answer in english please

@akshay-shah
Copy link
Author

akshay-shah commented Mar 14, 2017

He meant to say :
"Your problem is caused because the library is not loading a dependency called "libmodpdfium.so" ... this library is a dependency, a dependency.

When you add "com.github.barteksc: android-pdf-viewer: 2.1.0" to your project, it internally adds its dependency "com.github.barteksc: pdfium-android: 1.4.0", the latter has two dependencies Files so:

LibjniPdfium.so
Libmodpdfium.so

Check if Gradle downloaded these dependencies in the following path:

App / build / intermediates / exploded-aar / com.github.barteksc / android-pdf-viewer
App / build / intermediates / exploded-aar / com.github.barteksc / pdfium-android

The files are in the following path:

App / build / intermediates / exploded-aar / com.github.barteksc / pdfium-android / 1.4.0 / jni"

@saurabh321gupta
Copy link

@akshay-shah hello akshay! I am having the exact issue ,, have you resolved it ??? please please please tell me ....if you have ...then kindly reach me < saurabh321gupta@gmail.com > Thanks in advance.

@akshay-shah
Copy link
Author

have u tried the method given above ur comment.?

@saurabh321gupta
Copy link

@akshay-shah no i didn't .. because i'm working in Eclipse and I dont have that file named libjni..
kindly help.

@saurabh321gupta
Copy link

saurabh321gupta commented Mar 16, 2017 via email

@KnIfER
Copy link

KnIfER commented Jul 14, 2017

just ndk-build in this repo:PdfiumAndroid-master...

@chikkut
Copy link

chikkut commented Jan 25, 2019

Binary XML file line #24: Error inflating class com.github.barteksc.pdfviewer.PDFViewd.
How can i solve this issue?

<com.github.barteksc.pdfviewer.PDFViewd
android:visibility="gone"
android:id="@+id/pdfView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

@deepak786
Copy link

Please try to add android.bundle.enableUncompressedNativeLibs=false to your gradle.properties and check if the issue is resolved or not

@vfa-tuantt
Copy link

vfa-tuantt commented Nov 25, 2020

Add below code to fix it. It worked for me.

defaultConfig {
.....
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}

}
Link reference:
https://stackoverflow.com/questions/27186726/java-lang-unsatisfiedlinkerror-dalvik-system-pathclassloader

@Suaib100
Copy link

Error inflating class com.github.barteksc.pdfviewer.PDFView

@Roshanthecoder
Copy link

add jcenter() in settings.gradle and project gradle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests