[英]Flutter Android Splash screen errors
我希望在 Flutter 中构建的 Android 应用程序中简单地添加一个启动画面。 我想要一个红色的屏幕,中间有一个图像。 我在 Android 中有以下内容:
颜色.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name = "crimson">#D272638</color>
</resources>
launch_background.xml:
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/crimson" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="@drawable/logo" />
</item>
</layer-list>
我的文件结构如下:
每次我尝试运行该应用程序时,都会出现以下错误:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
path-to-app/android/app/src/main/res/values/colors.xml:3:5-43: AAPT: error: invalid color.
path-to-app/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml: AAPT: error: file failed to compile.
为什么要为闪屏和应用程序创建颜色?
对于发现自己陷入这种情况的下一个灵魂,我上面遇到的问题是因为我在 colors.xml 文件中使用了大写字母。 只需将所有字符都小写,您就可以使用 go。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.