0

I have seen in the Firebase Crashlytics dashboard that there is an user that had crashes in some of the app's activities in the OnCreate() method. I have seen that it is an error of the xml as the error is this one and it is related with the ImageView component:

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

I have seen that the layouts of the activities that are causing these crashes have in common that in the ImageView there is an attribute that is

android:scaleType="fitXY"

<ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="0.4"
                android:background="@drawable/img"
                android:scaleType="fitXY" />

So my question is, could that scaleType="fitXY" be causing all these crashes? Is it bad behaviour to use scaleType attribute in ImageViews then?

Thanks for the possible help

Nikunj
  • 3,937
  • 19
  • 33
Lechius
  • 189
  • 7
  • probably not, dig a bit deeper into the problem. it might not be related to the ImageView at all. – Shark Nov 01 '22 at 13:30
  • https://stackoverflow.com/a/57114852/20018861 in this other post the problem was because of the automatic scaling, why do you think that probably it is not a problem of scaling? – Lechius Nov 01 '22 at 13:33
  • This is something to do with the kind of image you are using. Maybe it is too big or format not supported. – Lawrence Gimenez Nov 01 '22 at 13:34
  • @LawrenceGimenez I am using hdpi,mdpi,xhdpi,xxhdpi and xxxhdpi drawable folders, I am supporting all the devices format, I don't know what could be causing the crash then.. – Lechius Nov 01 '22 at 13:37
  • how big is the picture? like, width * height and bytes? – Shark Nov 01 '22 at 13:41
  • Same here I have no idea but with InflateException the cause is mostly the source of your image. You need to test and dig deeper. – Lawrence Gimenez Nov 01 '22 at 13:42
  • @Shark the biggest image scaling (hdpi) is 550x480 and 4KB – Lechius Nov 01 '22 at 13:47
  • Then posting this piece of XML isn't going to be enough to pinpoint the problem. How about posting the whole XML and the inflating code as well? – Shark Nov 01 '22 at 16:21

0 Answers0