【发布时间】:2018-04-23 23:55:52
【问题描述】:
我正在处理一个颤振项目,iOS 版本运行良好,但 Android 无法构建。它给了我一个关于将我的样式添加到项目中的错误,但它仍然没有读取它们。这是我遇到的错误...
AAPT:错误:资源 drawable/launch_background(又名 com.yourcompany.flutterexample:drawable/launch_background) 没找到。
这是我在 app/src.main/res/values 文件夹中的 styles.xml 文件...
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
这就是我在 Manifest 中的阅读方式...
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
tools:replace="android:value"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
【问题讨论】:
-
drawable/launch_background 存在吗?
-
请尝试删除 android/app/build 文件夹一次