1

I've found this exception in my published app crash report. The error is NEVER occuring on my device, neither during debugging, neither on emulator. It happened only after publishing the app for some users, currently they use Nexus 4 device (info from Crashlytics).

This is the report:

Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{InfoActivity}: android.view.InflateException: Binary XML file line #13: Binary XML file line #13: **Error inflating class ImageView**

android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2419)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2479)
android.app.ActivityThread.-wrap11 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1347)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:148)
android.app.ActivityThread.main (ActivityThread.java:5421)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:726)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:616)

and this:

Caused by android.view.InflateException
Binary XML file line #13: Binary XML file line #13: Error inflating class ImageView
android.view.LayoutInflater.inflate (LayoutInflater.java:539)
android.view.LayoutInflater.inflate (LayoutInflater.java:423)
android.view.LayoutInflater.inflate (LayoutInflater.java:374)
androidx.appcompat.app.AppCompatDelegateImpl.setContentView (AppCompatDelegateImpl.java:545)
androidx.appcompat.app.AppCompatActivity.setContentView (AppCompatActivity.java:161)
InfoActivity.onCreate (InfoActivity.java:45)
android.app.Activity.performCreate (Activity.java:6280)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1116)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2372)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2479)
android.app.ActivityThread.-wrap11 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1347)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:148)
android.app.ActivityThread.main (ActivityThread.java:5421)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:726)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:616)

It is pointing to InfoActivity.onCreate (InfoActivity.java:45) which is in my InfoActivity.java this line: setContentView(R.layout.activity_info);

And in activity_info layout I have an ImageView:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

<RelativeLayout
    android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:background="#DBDBDB">

<ImageView
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:contentDescription="@string/logo"
    android:paddingLeft="32dp"
    android:paddingRight="32dp"
    android:adjustViewBounds="true"
    android:scaleType="fitCenter"
    android:src="@drawable/logo" />

I have the logo.png image in all drawable folders (hdpi,mdpi,xhdpi etc.) except the common drawable folder.

This crash happened only for the users on Nexus 4, also for another activity, where I have a Button with drawable image.

I also tried to move all the images also to ldpi folder which was empty, but I can't reproduce it now, as it happens only live for Nexus 4.

Not sure what is causing this as the drawable resource exists in all folders except the main drawable. I was thinking to put the images e.g. from xdpi to the common drawable folder, but not sure if this helps.

Gradle:

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "***"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 12
        versionName "2.02"
        ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    bundle {

        language {
            enableSplit = false
        }
    }
}
Darksymphony
  • 2,155
  • 30
  • 54
  • Can you share more details? App Gradle file to check target version and build OS version and also android OS version of Nexus 4. Have you tried Nexus 4 simulator to reproduce this error? – Hamza Khan Sep 07 '19 at 22:24
  • I updated my question with gradle details. The Nexus 4 OS version is 6.0.1. The simulator makes no errors when debugging. – Darksymphony Sep 07 '19 at 22:29
  • https://stackoverflow.com/a/48893308/8065249 check this link, it's giving same error as yours and the problem was with the drawable folder. He was putting it in drawable-v24 folders – Hamza Khan Sep 07 '19 at 22:31
  • yes I have read that before, this is not my case. I have drawable-v24 empty, there is nothing there – Darksymphony Sep 07 '19 at 22:34
  • seems this error happened only once for the mentioned device. As I have no solution for this, I will monitor if this will happen once again – Darksymphony Sep 24 '19 at 14:36

0 Answers0