我将手机更新到Android 8.1并启动了我的应用程序。我注意到一个奇怪的错误——“找不到资源”。在Android 7.1中,一切都运行良好。我已经试着清理和重建这个项目了。我认为下面的代码应该足以发现错误。
SplashActivity样式
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@drawable/background_splash</item>
</style>
bakcground\u 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>
显示
<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>
误差
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
事先谢谢你的帮助。祝你晚上愉快。