InflateException: строка двоичного XML-файла # 37: Ошибка надувания класса android.support.v4.view.ViewPager

android android-viewpager inflate-exception

510 просмотра

1 ответ

Мое приложение работает правильно на Android 5+, но на версиях ниже 5, это дает мне эту ошибку:

InflateException: строка двоичного XML-файла # 37: Ошибка надувания класса android.support.v4.view.ViewPager

Я много искал, но это не помогло мне. Компиляция SDK и целевой SDK 24.

Это мой logcat:

08-20 09:06:30.125 27168-27168/com.example.sher.jasonrecyclerdemo W/dalvikvm: VFY: unable to resolve interface method 19816: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
08-20 09:06:30.125 27168-27168/com.example.sher.jasonrecyclerdemo W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
08-20 09:06:30.125 27168-27168/com.example.sher.jasonrecyclerdemo W/dalvikvm: VFY: unable to resolve interface method 19818: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
08-20 09:06:30.125 27168-27168/com.example.sher.jasonrecyclerdemo W/dalvikvm: VFY: unable to resolve interface method 19822: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
08-20 09:06:30.125 27168-27168/com.example.sher.jasonrecyclerdemo W/dalvikvm: VFY: unable to resolve virtual method 492: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
08-20 09:06:30.125 27168-27168/com.example.sher.jasonrecyclerdemo W/dalvikvm: VFY: unable to resolve virtual method 514: Landroid/content/res/TypedArray;.getType (I)I
08-20 09:06:30.185 27168-27168/com.example.sher.jasonrecyclerdemo I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
08-20 09:06:30.215 27168-27168/com.example.sher.jasonrecyclerdemo W/ResourceType: Failure getting entry for 0x7f02004d (t=1 e=77) in package 0 (error -75) name=com.example.sher.jasonrecyclerdemo
08-20 09:06:30.215 27168-27168/com.example.sher.jasonrecyclerdemo W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x416bde18)
08-20 09:06:30.225 27168-27168/com.example.sher.jasonrecyclerdemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.sher.jasonrecyclerdemo, PID: 27168
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sher.jasonrecyclerdemo/com.example.sher.jasonrecyclerdemo.MainActivity}: android.view.InflateException: Binary XML file line #37: Error inflating class android.support.v4.view.ViewPager
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2653)
at android.app.ActivityThread.access$800(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5872)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #37: Error inflating class android.support.v4.view.ViewPager
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136)
at com.example.sher.jasonrecyclerdemo.MainActivity.onCreate(MainActivity.java:87)
at android.app.Activity.performCreate(Activity.java:5312)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2552)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2653) 
at android.app.ActivityThread.access$800(ActivityThread.java:156) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:157) 
at android.app.ActivityThread.main(ActivityThread.java:5872) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136) 
at com.example.sher.jasonrecyclerdemo.MainActivity.onCreate(MainActivity.java:87) 
at android.app.Activity.performCreate(Activity.java:5312) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2552) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2653) 
at android.app.ActivityThread.access$800(ActivityThread.java:156) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:157) 
at android.app.ActivityThread.main(ActivityThread.java:5872) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f02004d a=-1 r=0x7f02004d}
at android.content.res.Resources.loadDrawable(Resources.java:2106)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.view.View.<init>(View.java:3596)
at android.view.View.<init>(View.java:3526)
at android.view.ViewGroup.<init>(ViewGroup.java:464)
at android.support.v4.view.ViewPager.<init>(ViewPager.java:396)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:136) 
at com.example.sher.jasonrecyclerdemo.MainActivity.onCreate(MainActivity.java:87) 
at android.app.Activity.performCreate(Activity.java:5312) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2552) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2653) 
at android.app.ActivityThread.access$800(ActivityThread.java:156) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:157) 
at android.app.ActivityThread.main(ActivityThread.java:5872) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674) 
at dalvik.system.NativeStart.main(Native Method) 
Автор: Sherzad Источник Размещён: 08.11.2019 10:54

Ответы (1)


0 плюса

В соответствии с трассировкой стека Logcat, которую вы оставили здесь, я предполагаю, что в вашем коде есть несколько проблем или ошибок совместимости, так что это не просто одна ошибка в вашей деятельности.

Во-первых, вы должны оформить заказ, Contextчтобы предоставить класс adaper для раздувания .

и похоже, что вы передали inputкак, Drawableно это, кажется, intзначение или что-то еще.

также вы можете искать слово « вызвано » в ваших следах стека logcat, потому что точные сообщения об ошибках всегда приходят после этого.

Автор: Siamak SiaSoft Размещён: 20.08.2016 06:42
Вопросы из категории :
32x32