Style.xml flutter 插件项目中没有读取文件?
Style.xml file not read in flutter plugin project?
我有一个正在处理的 flutter 项目,iOS 构建效果很好,但 Android 没有构建。它给了我一个关于将我的样式添加到项目的错误,但它仍然没有读取它们。这是我遇到的错误...
AAPT: error: resource drawable/launch_background (aka
com.yourcompany.flutterexample:drawable/launch_background)
not found.
这是我在 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>
这就是我在清单中阅读它的方式...
<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>
AAPT 确实读取了您的 styles.xml 文件,这就是它抛出有关文件内容的错误的原因。当它尝试 link LaunchTheme 的子样式 android:windowBackground 时,它会看到对名为 launch_background 的可绘制对象的引用,该引用无法解析。
确保在任何 res/drawable/ 目录中有一个名为 "launch_background" 的可绘制对象。
我有一个正在处理的 flutter 项目,iOS 构建效果很好,但 Android 没有构建。它给了我一个关于将我的样式添加到项目的错误,但它仍然没有读取它们。这是我遇到的错误...
AAPT: error: resource drawable/launch_background (aka com.yourcompany.flutterexample:drawable/launch_background) not found.
这是我在 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>
这就是我在清单中阅读它的方式...
<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>
AAPT 确实读取了您的 styles.xml 文件,这就是它抛出有关文件内容的错误的原因。当它尝试 link LaunchTheme 的子样式 android:windowBackground 时,它会看到对名为 launch_background 的可绘制对象的引用,该引用无法解析。
确保在任何 res/drawable/ 目录中有一个名为 "launch_background" 的可绘制对象。