RuntimeException: Error inflating class ImageButton in mi_activity_intro
firefinchdev opened this issue · 7 comments
This is the stack trace from my crashlytics
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.softinit.iquitos.mainapp/com.softinit.iquitos.mainapp.ui.intro.AppIntroActivity}: android.view.InflateException: Binary XML file line #44 in com.softinit.iquitos.mainapp:layout/mi_activity_intro: Binary XML file line #44 in com.softinit.iquitos.mainapp:layout/mi_activity_intro: Error inflating class ImageButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by android.view.InflateException: Binary XML file line #44 in com.softinit.iquitos.mainapp:layout/mi_activity_intro: Binary XML file line #44 in com.softinit.iquitos.mainapp:layout/mi_activity_intro: Error inflating class ImageButton
Please refer to the following stackoverflow answer:
https://stackoverflow.com/a/35449255/8183406
Maybe replacing @android:color/white with hex code may resolve this issue.
See #284
Observed on Pixel XL running Android 10 and Huawei running Android 8 devices...
Can you reproduce the issue on the emulator and narrow down the impact?
Nope, was unable to reproduce on emulator also.
Using color references in drawable XML should not break XML parsing, unless there's a bug in the Android system.
Does the stacktrace mention anything other than the layout XML?
https://github.com/heinrichreimer/material-intro/blob/d88c95dbdbfaf70d33e7a7b7bf3558609a3e54d5/library/src/main/res/layout/mi_activity_intro.xml#L44-L55
Using color references in drawable XML should not break XML parsing, unless there's a bug in the Android system.
Yes, I agree with you. That should not happen.
Does the stacktrace mention anything other than the layout XML?
https://github.com/heinrichreimer/material-intro/blob/d88c95dbdbfaf70d33e7a7b7bf3558609a3e54d5/library/src/main/res/layout/mi_activity_intro.xml#L44-L55
Following is the remaining text in the stacktrace
Caused by android.content.res.Resources$NotFoundException: Drawable (missing name) with resource ID #0x7f0801e4
Caused by android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f0801e4
at android.content.res.ResourcesImpl.getResourceName(ResourcesImpl.java:253)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:760)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:630)
at android.content.res.Resources.loadDrawable(Resources.java:886)
at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:953)
at android.content.res.TypedArray.getDrawable(TypedArray.java:928)
at android.widget.ImageView.<init>(ImageView.java:188)
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.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1457)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.heinrichreimersoftware.materialintro.app.IntroActivity.onCreate(IntroActivity.java:206)
at com.softinit.iquitos.mainapp.ui.intro.AppIntroActivity.onCreate(AppIntroActivity.java:23)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)