I updated my phone to android 8.1 and launched my app. I noticed the strange error - "resources not found". In android 7.1 everything works well. I've already tried to clean and rebuild project. I think the code below should be enough to find an error.
SplashActivity style
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@drawable/background_splash</item>
</style>
bakcground_splash.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/colorPrimaryDark"/>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher"/>
</item>
</layer-list>
Manifest
<activity
android:name=".splash.SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="http"
android:host="music.pl"
android:pathPrefix="/music" />
</intent-filter>
</activity>
Error
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.linkplayer.linkplayer/com.linkplayer.linkplayer.splash.SplashActivity}: android.content.res.Resources$NotFoundException: Drawable com.linkplayer.linkplayer:drawable/background_splash with resource ID #0x7f07005e
Thanks in advance for the help. Have a nice evening.
The error was in this part of xml:
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher"/>
</item>
I don't know why but Android 8.0+ can't see mipmaps. I had to use file from "drawable" directory:
<item>
<bitmap
android:gravity="center"
android:src="@drawable/my_drawable"/>
</item>
Hope it will help you.