So around 1% of my daily users are haunted with the NavigationView exception which is caused by an image resource not being found. I find that strange, 99% of other users are just fine. I was hoping that updating my dependancies in version iterations will resolve the issue itself, but unfortunately, this error has stayed in my Crashlytics logs for 6 iterations already and it's the worst crash that is affecting my users.
The obvious thing would be that it is specific to older devices, but this would be a wrong assumption. It is not device specific, neither version specific. Although some specifics can be pointed out
- Android Version
- 90% Andorid 8
- 10% Android 7
- Device
- Huawei 50%
- Samsung 50%
Two relevant dependancies i'm using:
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
The relevant piece of code in the XML layout:
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:theme="@style/ThemeOverlay.AppCompat.Light"
app:headerLayout="@layout/layout_drawer_header2"
app:menu="@menu/navigation" />
The Header layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/authWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/windowBackground"
android:orientation="vertical"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
tools:layout_width="240dp">
<TextView
android:id="@+id/number"
style="@style/Base.TextAppearance.AppCompat.Display3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:fontFamily="sans-serif-medium"
android:textColor="?android:textColorPrimary"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="@+id/car"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/driver"
tools:text="#01" />
<ImageView
android:id="@+id/driverIcon"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
app:layout_constraintBottom_toBottomOf="@+id/driver"
app:layout_constraintStart_toEndOf="@+id/number"
app:layout_constraintTop_toTopOf="@+id/driver"
app:srcCompat="@drawable/ic_person_white_24dp" />
<TextView
android:id="@+id/driver"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="2dp"
android:layout_marginTop="16dp"
android:drawablePadding="8dp"
android:ellipsize="end"
android:lines="1"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/driverIcon"
app:layout_constraintTop_toTopOf="parent"
tools:text="Drivers name" />
<ImageView
android:id="@+id/coDriverIcon"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
app:layout_constraintBottom_toBottomOf="@+id/codriver"
app:layout_constraintStart_toEndOf="@+id/number"
app:layout_constraintTop_toTopOf="@+id/codriver"
app:srcCompat="@drawable/ic_person_white_24dp" />
<TextView
android:id="@+id/codriver"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="2dp"
android:drawablePadding="8dp"
android:ellipsize="end"
android:lines="1"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/coDriverIcon"
app:layout_constraintTop_toBottomOf="@+id/driver"
tools:text="Co-Driver name" />
<ImageView
android:id="@+id/carIcon"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
app:layout_constraintBottom_toBottomOf="@+id/car"
app:layout_constraintStart_toEndOf="@+id/number"
app:layout_constraintTop_toTopOf="@+id/car"
app:srcCompat="@drawable/ic_car_white_24dp" />
<TextView
android:id="@+id/car"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="2dp"
android:ellipsize="end"
android:lines="1"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/carIcon"
app:layout_constraintTop_toBottomOf="@+id/codriver"
tools:text="Racing Car" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<ImageView
android:id="@+id/image"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
app:srcCompat="@drawable/ic_account_circle_white_24dp" />
<ImageView
android:id="@+id/logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:padding="12dp"
android:tint="@android:color/white"
app:srcCompat="@drawable/ic_log_out" />
</RelativeLayout>
<TextView
android:id="@+id/switchText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="16dp"
android:layout_marginRight="8dp"
android:autoLink="web"
android:gravity="center_vertical"
android:maxLines="2"
android:text="@string/track_me_on_racelivemaps_com"
app:layout_constraintEnd_toStartOf="@+id/trackingOn"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/number" />
<Switch
android:layout_width="wrap_content"
android:id="@+id/trackingOn"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_height="wrap_content"
android:padding="8dp"
android:autoLink="web"
android:gravity="center_vertical"
android:maxLines="2"
app:layout_constraintBottom_toBottomOf="@+id/switchText"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/switchText" />
<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:text="@string/active_stage"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Body2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/switchText" />
<Spinner
android:id="@+id/activeStage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView12" />
</androidx.constraintlayout.widget.ConstraintLayout>
The menu:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="@string/mode">
<menu>
<group android:checkableBehavior="single">
<item
android:id="@+id/recce"
android:icon="@drawable/ic_write_black_24dp"
android:title="@string/reccemode" />
<item
android:id="@+id/liaison"
android:icon="@drawable/ic_route_black_24dp"
android:title="@string/liaisonmode" />
<item
android:id="@+id/racing"
android:icon="@drawable/ic_racing_flag_black_24dp"
android:title="@string/racemode" />
<item
android:id="@+id/tsd"
android:icon="@drawable/ic_timer_black_24dp"
android:title="@string/tsd" />
<item
android:id="@+id/tsd_advanced"
android:icon="@drawable/ic_tsd_advanced"
android:title="@string/tsd_advanced" />
<item
android:id="@+id/custom_1"
android:icon="@drawable/ic_navigation_layout"
android:title="@string/custom_layout_1" />
<item
android:id="@+id/custom_2"
android:icon="@drawable/ic_navigation_layout"
android:title="@string/custom_layout_2" />
<item
android:id="@+id/custom_3"
android:icon="@drawable/ic_navigation_layout"
android:title="@string/custom_layout_3" />
</group>
</menu>
</item>
<group android:checkableBehavior="none">
<item
android:id="@+id/stages"
android:icon="@drawable/ic_stage_black_24dp"
android:title="@string/special_stages" />
<item
android:id="@+id/settings"
android:icon="@drawable/ic_settings_black_24dp"
android:title="@string/settings" />
<item
android:id="@+id/customize_ui"
android:icon="@drawable/ic_layout_edit"
android:title="@string/customize_ui" />
<item
android:id="@+id/weather"
android:icon="@drawable/ic_weather"
android:title="@string/weather" />
<item
android:id="@+id/login"
android:icon="@drawable/ic_key_white_24dp"
android:title="@string/log_in" />
<item
android:id="@+id/manual"
android:icon="@drawable/ic_manual"
android:title="@string/user_manual" />
<item
android:id="@+id/language"
android:icon="@drawable/ic_translate"
android:title="@string/language" />
<item
android:id="@+id/invite"
android:icon="@drawable/ic_share_black_24dp"
android:title="@string/invite" />
<item
android:id="@+id/feedback"
android:icon="@drawable/ic_feedback_black_24dp"
android:title="@string/feedback_report_bug" />
<item
android:id="@+id/tester"
android:icon="@drawable/ic_tester"
android:title="@string/become_a_tester" />
<item
android:id="@+id/policy"
android:icon="@drawable/ic_policy"
android:title="@string/privacy_policy" />
<item
android:id="@+id/logoff"
android:icon="@drawable/ic_key_white_24dp"
android:title="@string/log_off" />
<item
android:id="@+id/exit"
android:icon="@drawable/ic_exit_to_app_black_24dp"
android:title="@string/exit" />
</group>
</menu>
And finally the crash logs.
android.view.InflateException: Binary XML file line #48: Binary XML file line #48: Error inflating class com.google.android.material.navigation.NavigationView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3173) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3284) at android.app.ActivityThread.-wrap12(Unknown Source) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1894) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7383) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
Caused by android.view.InflateException: Binary XML file line #48: Binary XML file line #48: Error inflating class com.google.android.material.navigation.NavigationView
Caused by android.view.InflateException: Binary XML file line #48: Error inflating class com.google.android.material.navigation.NavigationView
Caused by java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Constructor.java) at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at android.view.LayoutInflater.createView(LayoutInflater.java:658) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:801) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) at android.view.LayoutInflater.rInflate(LayoutInflater.java:874) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:835) 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:469) at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) at ee.siimplangi.rallytripmeter.activities.MainActivity.onCreate(MainActivity.kt:186) at android.app.Activity.performCreate(Activity.java:7358) at android.app.Activity.performCreate(Activity.java:7349) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1219) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3126) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3284) at android.app.ActivityThread.-wrap12(Unknown Source) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1894) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7383) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
Caused by android.view.InflateException: Binary XML file line #29: Binary XML file line #29: Error inflating class ImageView
Caused by android.view.InflateException: Binary XML file line #29: Error inflating class ImageView
Caused by android.content.res.Resources$NotFoundException: Resource ID
0x7f0800a5
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:290) at android.content.res.Resources.getValue(Resources.java:1476) at androidx.appcompat.widget.AppCompatDrawableManager.createDrawableIfNeeded(AppCompatDrawableManager.java:235) at androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200) at androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191) at androidx.appcompat.content.res.AppCompatResources.getDrawable(AppCompatResources.java:102) at androidx.appcompat.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:59) at androidx.appcompat.widget.AppCompatImageView.(AppCompatImageView.java:78) at androidx.appcompat.widget.AppCompatImageView.(AppCompatImageView.java:68) at androidx.appcompat.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:182) at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106) at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266) at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:783) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) at android.view.LayoutInflater.rInflate(LayoutInflater.java:874) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:835) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at com.google.android.material.internal.NavigationMenuPresenter.inflateHeaderView(NavigationMenuPresenter.java:207) at com.google.android.material.navigation.NavigationView.inflateHeaderView(NavigationView.java:281) at com.google.android.material.navigation.NavigationView.(NavigationView.java:193) at com.google.android.material.navigation.NavigationView.(NavigationView.java:104) at java.lang.reflect.Constructor.newInstance0(Constructor.java) at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at android.view.LayoutInflater.createView(LayoutInflater.java:658) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:801) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) at android.view.LayoutInflater.rInflate(LayoutInflater.java:874) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:835) 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:469) at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) at ee.siimplangi.rallytripmeter.activities.MainActivity.onCreate(MainActivity.kt:186) at android.app.Activity.performCreate(Activity.java:7358) at android.app.Activity.performCreate(Activity.java:7349) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1219) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3126) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3284) at android.app.ActivityThread.-wrap12(Unknown Source) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1894) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7383) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
from Error inflating class NavigationView caused by ResourceNotFoundException
No comments:
Post a Comment