For me, inside one of my layout.xml files, I had
<ImageView android:id="@+id/row_1_col_0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@string/default_picture_location"> </ImageView>
and inside strings.xml, I had
<string name="default_picture_location">"@mipmap/tile"</string>
and this was shown in Android Studio:
<ImageView android:id="@+id/row_1_col_0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/tile"> </ImageView>
I thought that everything would work, because there were no errors, and the application was compiled and launched. However, there was a run-time error that said: "android.view.InflateException: binary line of XML file # 7: error inflating the ImageView class."
As soon as I changed android: background from
android:background="@string/default_picture_location"
to
android:background="@mipmap/tile"
everything worked.
source share