Skip to main content
1 de 2

Error con splash screen en Android 8.0

tengo una aplicación con splash screen, funciona correctamente, pero en Android 8.0 me da el siguiente error, dice que no encuentra el drawable..

FATAL EXCEPTION: main
Process: com.app.atsz7.scurls, PID: 11355
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.atsz7.scurls/com.app.atsz7.scurls.splash.SplashScreenActivity}: android.content.res.Resources$NotFoundException: Drawable com.app.atsz7.scurls:drawable/splash with resource ID #0x7f0800a5
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.content.res.Resources$NotFoundException: Drawable com.app.atsz7.scurls:drawable/splash with resource ID #0x7f0800a5
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/splash.xml from drawable resource ID #0x7f0800a5
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:768)
    at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:600)
    at android.content.res.Resources.getDrawableForDensity(Resources.java:876)
    at android.content.res.Resources.getDrawable(Resources.java:818)
    at android.content.Context.getDrawable(Context.java:605)
    at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:351)
    at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
    at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:87)
    at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:128)
    at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:149)
    at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:29)
    at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:54)
    at android.support.v7.app.AppCompatDelegateImplV23.<init>(AppCompatDelegateImplV23.java:31)
    at android.support.v7.app.AppCompatDelegateImplN.<init>(AppCompatDelegateImplN.java:31)
    at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:198)
    at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:183)
    at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:519)
    at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:70)
    at com.app.atsz7.scurls.splash.SplashScreenActivity.onCreate(SplashScreenActivity.java:16)
    at android.app.Activity.performCreate(Activity.java:6975)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #0: <bitmap> requires a valid 'src' attribute
    at android.graphics.drawable.BitmapDrawable.updateStateFromTypedArray(BitmapDrawable.java:823)
    at android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:754)
    at android.graphics.drawable.DrawableInflater.inflateFromXmlForDensity(DrawableInflater.java:142)
    at android.graphics.drawable.Drawable.createFromXmlInnerForDensity(Drawable.java:1295)
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1284)
    at android.graphics.drawable.LayerDrawable.inflateLayers(LayerDrawable.java:279)
    at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:194)
    at android.graphics.drawable.DrawableInflater.inflateFromXmlForDensity(DrawableInflater.java:142)
    at android.graphics.drawable.Drawable.createFromXmlInnerForDensity(Drawable.java:1295)
    at android.graphics.drawable.Drawable.createFromXmlForDensity(Drawable.java:1254)
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:758)

cargo el splash screen desde un drawable utilizando un style, este es el drawable.

<?xml version="1.0" encoding="utf-8"?>
<item>
    <bitmap
        android:src="@mipmap/ic_launcher"
        android:gravity="center" />
</item>

Muchas gracias!.