gradle 构建时的Flutter误差:对于< color>给定的资源值无效

4uqofj5v  于 2022-11-14  发布在  Flutter
关注(0)|答案(1)|浏览(367)

我想用flutter_launcher_icons软件包更改应用程序图标,但在我执行flutter run后,我得到了以下错误,即使我从未编辑错误中提到的文件
这是错误:

PS C:\Flutter\appname> flutter run
Launching lib\main.dart on Pixel 5 in debug mode...
C:\Users\jjkla\.gradle\caches\transforms-3\8de94d7eb39fc01aa715c73f850e88dc\transformed\core-1.6.0\res\values\values.xml:5:4: Invalid <color> for given resource value.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
   > Resource compilation failed. Check logs for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 13s
Running Gradle task 'assembleDebug'...                             14,3s

表示颜色无效的文件部分:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr format="reference" name="nestedScrollViewStyle"/>
    <color name="androidx_core_ripple_material_light">#1f000000</color>
    <color name="androidx_core_secondary_text_default_material_light">#7E000000</color>
    <color name="notification_action_color_filter">#ffffffff</color>
    <color name="notification_icon_bg_color">#ff9e9e9e</color>
    <dimen name="compat_button_inset_horizontal_material">4dp</dimen>
...

我重新安装了Android Studio,做了Flutter清理,更新了Java,运行Flutter医生都没有成功。以前有没有人遇到过这个错误?

col17t5w

col17t5w1#

你能从两种颜色中去掉2个f吗?因为颜色hashCode长度应该是6。
你的文件应该像这样。

<color name="notification_action_color_filter">#ffffff</color>
<color name="notification_icon_bg_color">#9e9e9e</color>

相关问题