I am receiving many errors of kind displayed in the subj. These errors seems to be occasional and I cannot reproduce them. From stack I can learn that such error may occurs
You should copy the image files from the "drawable-24" folder to the "drawable" folder.
For me it happened because I tried to mix xml vector graphics images with ordinary png in the same layout file,
only after I replaced the xml vector graphics with pngs it started to work
i had the same issue and it solved by removing drawable-v24 with (24) in front of images in drawable folder and replacing them with ordinary drawables.
I know this thread is old, but still answering it so that no-one else should spend sleepless nights.
I was refactoring an old project, whose layout files all contained hardcoded
attributes such as android:maxLength = 500
. So I decided to register it in my
res/dimen
file as <dimen name="max_length">500</dimen>
.
Finished refactoring almost 30 layout files with my res-value. Guess what? the next time I ran my project it started throwing the same InflateException
.
As a solution, needed to redo my all changes and keep all-those values as same as before.
TLDR;
step 1: All running good.
step 2: To boost my maintenance I replaced android:maxLength = 500
with <dimen name="max_length">500</dimen>
and android:maxLength = @dimen/max_length
, that's where it all went wrong(crashing with InflateException
).
step 3: All running bad
step 4: Re-do all my work by again replacing android:maxLength = @dimen/max_length
with android:maxLength = 500
.Everything got fixed.
step 5: All running good.
I had the same error in Crashlytics
from a strange device:
Motorola One Vision Android 5.1 and 20 GB (free) RAM, rooted
This device comes originally with Android 9.0, 4 GB RAM
Probably someone is trying to hack the app I'm currently developing and has problems dealing with multi-APKs. So drawables can't be found and the app delivers the crash
I found the same error, and it took two days to identify what the error was.
The error was simply because I was trying to use: android:background
Rather than: app:srcCompat
in an SVG file.
In your case, I believe this is it
<ImageView
android:scaleType="fitXY"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/tour_11" <-- the error is here !
/>
I recommend using it this way
add this to your build.gradle app
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
and
<androidx.appcompat.widget.AppCompatImageView <-- use **AppCompatImageView** not **ImageView**
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@drawable/tour_11"
/>
I hope this helps.