On some Android devices, I am getting "Resources$NotFoundException: Drawable (missing name) with resource ID" error, e.g.:
On LGE Android 8.1 devices it is complaining
Unable to start activity ComponentInfo{SplashActivity}: android.view.InflateException: Binary XML file line #20: Binary XML file line #20: Error inflating class ImageView
For the following part. In particular, it is complaining "android:src="@drawable/red_logo""
<ImageView
android:id="@+id/logoImageView"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/red_logo" />
I checked the source code directory, "red_logo.png" already exists in the following folders:
- drawable
- drawable-hdpi
- drawable-ldpi
- drawable-mdpi
- drawable-xhdpi
- drawable-xxhdpi
- drawable-xxxhdpi
Here is the Java code
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash); <---- Fails here
}
The dimension of red_logo.png in drawable folder is 4864 × 2692, same size as the red_logo.png in drawable-xxxhdpi folder. Is it too big?
I did a lot of research but it seems I cannot find a valid answer.
Thank you. Best regards.