Duplicate resources --> string/app_name

Execution failed for task ‘:app:mergeReleaseResources’.

[string/app_name] /Users/net.cctv3.i/bookkeeping-mobile/android/app/src/main/res/values/strings.xml [string/app_name] /Users/net.cctv3.i/bookkeeping-mobile/android/app/build/generated/res/resValues/release/values/gradleResValues.xml: Error: Duplicate resources

> Task :app:mergeReleaseResources FAILED
ERROR:[string/app_name] /Users/net.cctv3.i/bookkeeping-mobile/android/app/src/main/res/values/strings.xml [string/app_name] /Users/net.cctv3.i/bookkeeping-mobile/android/app/build/generated/res/resValues/release/values/gradleResValues.xml: Resource and asset merger: Duplicate resources
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> [string/app_name] /Users/net.cctv3.i/bookkeeping-mobile/android/app/src/main/res/values/strings.xml [string/app_name] /Users/net.cctv3.i/bookkeeping-mobile/android/app/build/generated/res/resValues/release/values/gradleResValues.xml: Error: Duplicate resources

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 20m 30s

事情的起因是,我构建的时候,动态传入了app_name,最后构建的时候,提示两处app_name冲突。所以解决的方式,最简单的就是把android/app/src/main/res/values/strings.xml里面的app_name那一行删掉,重新运行 …

作者

陈桥驿站

发布于

2024-12-29

更新于

2025-01-15

许可协议

评论