Reputation: 3180
I am getting Resources$NotFoundException mostly on Vivo devices. This is only happening for Drawable resources. I have all variant from mdpi till xxxhdpi. All these are pngs. I am unable to replicate this and only getting this on production in 4 different places. 2 of which are in splash screen and 1 is in facebook login library on this line for this drawable. Which means these users are unable to enter the app. Any idea if there some special handling that need to be done for these devices? I have never faced something like this before.
sample code
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:adjustViewBounds="true"
app:srcCompat="@drawable/splash"
app:layout_constraintWidth_max="400dp"
app:layout_constraintBottom_toTopOf="@+id/white_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:src="@drawable/splash"/>
here I am getting this crash due to splash
Drawable.
Stack Trace
Caused by android.content.res.Resources$NotFoundException Unable to find resource ID #0x7f08013d com.myapp.ui.splashScreen.SplashScreenActivity.onCreate
Caused by android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f08013d at android.content.res.ResourcesImpl.getResourceName(ResourcesImpl.java:292) at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:879) at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:749) at android.content.res.Resources.loadDrawable(Resources.java:922) at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:953) at android.content.res.TypedArray.getDrawable(TypedArray.java:928) at android.widget.ImageView.(ImageView.java:188) at android.widget.ImageView.(ImageView.java:171) at androidx.appcompat.widget.AppCompatImageView.(AppCompatImageView.java:72) at androidx.appcompat.widget.AppCompatImageView.(AppCompatImageView.java:68) at androidx.appcompat.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:187) at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:107) at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266) at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:817) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:775) at android.view.LayoutInflater.rInflate(LayoutInflater.java:908) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:869) at android.view.LayoutInflater.inflate(LayoutInflater.java:521) at android.view.LayoutInflater.inflate(LayoutInflater.java:429) at android.view.LayoutInflater.inflate(LayoutInflater.java:380) at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:141) at com.myapp.ui.splashScreen.SplashScreenActivity.onCreate(SplashScreenActivity.java:81) at android.app.Activity.performCreate(Activity.java:7129) at android.app.Activity.performCreate(Activity.java:7120) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2906) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3031) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1732) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:192) at android.app.ActivityThread.main(ActivityThread.java:6792) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)
Upvotes: 8
Views: 721
Reputation: 666
I had the same issue for Vivo phones almost exclusively, I then added the image to a noDpi and that resolved it.
Upvotes: -1