gradle Unity构建失败,因为重复资源

jtw3ybtb  于 2023-06-23  发布在  其他
关注(0)|答案(2)|浏览(185)

我正在使用Unity 2020.3.20f1 a我试图构建我的应用程序,但每次都失败。问题是有一些重复的资源。以下是控制台揭示的问题:

CommandInvokationFailure: Gradle build failed. 
/Users/camillapoggianti/Desktop/2020.3.20f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Users/camillapoggianti/Downloads/gradle-6.1.1/lib/gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
[style-v21/BaseUnityTheme] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values-v21/styles.xml [style-v21/BaseUnityTheme] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values-v21/styles 2.xml: Resource and asset merger: Duplicate resources
[id/unitySurfaceView] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/ids 2.xml [id/unitySurfaceView] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/ids.xml: Resource and asset merger: Duplicate resources
[style/UnityThemeSelector] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles.xml [style/UnityThemeSelector] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles 2.xml: Resource and asset merger: Duplicate resources
[style/BaseUnityTheme] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles.xml [style/BaseUnityTheme] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles 2.xml: Resource and asset merger: Duplicate resources
[style/UnityThemeSelector.Translucent] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles.xml [style/UnityThemeSelector.Translucent] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles 2.xml: Resource and asset merger: Duplicate resources
[string/app_name] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/strings.xml [string/app_name] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/strings 2.xml: Resource and asset merger: Duplicate resources
[string/game_view_content_description] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/strings.xml [string/game_view_content_description] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/strings 2.xml: Resource and asset merger: Duplicate resources

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:mergeReleaseResources'.
> [style-v21/BaseUnityTheme] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values-v21/styles.xml   [style-v21/BaseUnityTheme] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values-v21/styles 2.xml: Error: Duplicate resources
  [id/unitySurfaceView] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/ids 2.xml [id/unitySurfaceView] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/ids.xml: Error: Duplicate resources
  [style/UnityThemeSelector] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles.xml   [style/UnityThemeSelector] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles 2.xml: Error: Duplicate resources
  [style/BaseUnityTheme] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles.xml   [style/BaseUnityTheme] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles 2.xml: Error: Duplicate resources
  [style/UnityThemeSelector.Translucent] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles.xml   [style/UnityThemeSelector.Translucent] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/styles 2.xml: Error: Duplicate resources
  [string/app_name] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/strings.xml   [string/app_name] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/strings 2.xml: Error: Duplicate resources
  [string/game_view_content_description] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/strings.xml  [string/game_view_content_description] /Users/camillapoggianti/Desktop/Tappa_Capanna/Temp/gradleOut/launcher/src/main/res/values/strings 2.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

BUILD FAILED in 2s
]
stdout[

> Configure project :launcher
WARNING: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8

> Task :unityLibrary:preBuild UP-TO-DATE
> Task :launcher:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :launcher:generateReleaseBuildConfig UP-TO-DATE
> Task :launcher:javaPreCompileRelease UP-TO-DATE
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :launcher:generateReleaseResValues UP-TO-DATE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResValues UP-TO-DATE
> Task :unityLibrary:generateReleaseResources UP-TO-DATE
> Task :launcher:generateReleaseResources UP-TO-DATE
> Task :unityLibrary:packageReleaseResources UP-TO-DATE
> Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
> Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :unityLibrary:compileReleaseLibraryResources UP-TO-DATE
> Task :unityLibrary:parseReleaseLocalResources UP-TO-DATE
> Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
> Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
> Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
> Task :unityLibrary:compileReleaseShaders NO-SOURCE
> Task :unityLibrary:generateReleaseAssets UP-TO-DATE

> Task :launcher:mergeReleaseResources FAILED

> Task :unityLibrary:packageReleaseAssets
> Task :unityLibrary:processReleaseManifest
16 actionable tasks: 3 executed, 13 up-to-date
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <f94168442e634613b6a5965ed17c38f4>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <f94168442e634613b6a5965ed17c38f4>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <f94168442e634613b6a5965ed17c38f4>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <f94168442e634613b6a5965ed17c38f4>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <f94168442e634613b6a5965ed17c38f4>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <f94168442e634613b6a5965ed17c38f4>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <f94168442e634613b6a5965ed17c38f4>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <f94168442e634613b6a5965ed17c38f4>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <f94168442e634613b6a5965ed17c38f4>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <f94168442e634613b6a5965ed17c38f4>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <f94168442e634613b6a5965ed17c38f4>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <f94168442e634613b6a5965ed17c38f4>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:337)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

我已经试过了。我输入我的文件夹的项目,我手动删除重复的文件。但当我再次建造时,这些资源又回来了。我该如何解决这个问题?

zujrkrfu

zujrkrfu1#

我有同样的问题,并删除缓存文件夹中的“USER_HOME/.gradle/缓存”文件夹,并重建项目。我希望它能帮助你

x6yk4ghg

x6yk4ghg2#

好吧...我用这种方法解决了我的问题。起初我只删除了项目文件夹中的重复资源,但当我再次构建项目时,这些资源又回来了,构建失败了。后来我尝试从Unity的安装文件夹(2020.3.20f1)和我的项目文件夹中删除重复的资源...我不知道为什么,但现在构建正确完成了!我希望这能帮助到一些人…

相关问题