Reputation: 9129
I have a flutter project I'm working on and the iOS build works great but the Android doesn't build. It gives me an error about adding my styles to the project, but it still doesn't read them. Here is the error I'm getting...
AAPT: error: resource drawable/launch_background (aka com.yourcompany.flutterexample:drawable/launch_background) not found.
Here is my styles.xml file within the app/src.main/res/values folder...
<?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>
And this is how I'm reading it in my 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>
Upvotes: 1
Views: 4866
Reputation: 7532
AAPT does read your styles.xml file, that's why it's throwing errors about the content of the file. When it tries to link the style LaunchTheme's child android:windowBackground it sees the reference to a drawable named launch_background, which cannot be resolved.
Make sure you have a drawable named "launch_background" in any of your res/drawable/ directories.
Upvotes: 3