问题描述
我有一个包含imagebutton的基本活动,它在我的android 8.0+手机上运行良好。但是当我在android 5.0上切换到htc时,安装和调试后崩溃表明我的imagebutton无法使用。我解决这个问题?非常感谢!
下面是我的跟踪跟踪:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.amuze,PID: 10311
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.amuze/com.example.amuze.MainActivity}: android.view.InflateException: Binary XML file line #90: Error inflating class ImageButton
at android.app.ActivityThread.performlaunchActivity(ActivityThread.java:2411)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5696)
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:1028)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
Caused by: android.view.InflateException: Binary XML file line #90: Error inflating class ImageButton
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at com.example.amuze.Playlist.onCreateView(Playlist.java:140)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.movetoState(FragmentManagerImpl.java:881)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
at androidx.fragment.app.FragmentManagerImpl.movetoState(FragmentManagerImpl.java:1303)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2663)
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1288)
at android.app.Activity.performStart(Activity.java:5974)
at android.app.ActivityThread.performlaunchActivity(ActivityThread.java:2374)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5696)
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:1028)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.amuze:drawable/play" (7f060075) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060075 a=-1 r=0x7f060075}
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2444)
at android.content.res.Resources.loadDrawable(Resources.java:2384)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.widget.ImageView.<init>(ImageView.java:146)
at android.widget.ImageButton.<init>(ImageButton.java:86)
at android.widget.ImageButton.<init>(ImageButton.java:82)
at androidx.appcompat.widget.AppCompatimageButton.<init>(AppCompatimageButton.java:73)
at androidx.appcompat.widget.AppCompatimageButton.<init>(AppCompatimageButton.java:69)
at androidx.appcompat.app.AppCompatViewInflater.createImageButton(AppCompatViewInflater.java:207)
at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:123)
at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1407)
at androidx.app
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)