A failure occurred while executing com.android.build.gradle.internal.tasks.

报错信息
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade See the Console for details.
更为详细的:(和下面这个类似,这个不是我本人的报错信息,我已经解决啦)

CommandInvokationFailure: Gradle build failed.
/Users/abdollah/Documents/2021.3.9f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Users/abdollah/Documents/2021.3.9f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

Environment Variables:
XPC_SERVICE_NAME = application.com.unity3d.unityhub.4453083592.4453083598
XPC_FLAGS = 0x0
JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
MallocNanoZone = 0
ORIGINAL_XDG_CURRENT_DESKTOP = undefined
SHELL = /bin/bash
SSH_AUTH_SOCK = /private/tmp/com.apple.launchd.FJUFnBdKV2/Listeners
HOME = /Users/abdollah
PATH = /usr/bin:/bin:/usr/sbin:/sbin
__CFBundleIdentifier = com.unity3d.unityhub
USER = abdollah
__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x0
TMPDIR = /var/folders/px/_sbyry0d1zb4n_t6fqtfb4t80000gn/T/
LOGNAME = abdollah
JAVA_HOME = /Users/abdollah/Documents/2021.3.9f1/PlaybackEngines/AndroidPlayer/OpenJDK
COMMAND_MODE = unix2003

stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':launcher:mergeReleaseJavaResource'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
More than one file was found with OS independent path 'META-INF/kotlinx_coroutines_core.version'.

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 20s
]
stdout[
Starting a Gradle Daemon (subsequent builds will be faster)

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:OneSignalConfig.plugin:preBuild UP-TO-DATE
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:OneSignalConfig.plugin:preReleaseBuild UP-TO-DATE> Task :launcher:generateReleaseBuildConfig UP-TO-DATE
Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
Task :unityLibrary:OneSignalConfig.plugin:compileReleaseAidl NO-SOURCE
Task :launcher:javaPreCompileRelease UP-TO-DATE
Task :unityLibrary:compileReleaseAidl NO-SOURCE
Task :launcher:compileReleaseRenderscript NO-SOURCE
Task :launcher:compileReleaseAidl NO-SOURCE
Task :launcher:generateReleaseResValues UP-TO-DATE
Task :launcher:generateReleaseResources UP-TO-DATE
Task :unityLibrary:generateReleaseResValues UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:packageReleaseRenderscript NO-SOURCE
Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
Task :unityLibrary:generateReleaseResources UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:compileReleaseRenderscript NO-SOURCE
Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:generateReleaseResValues UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:generateReleaseResources UP-TO-DATE
Task :launcher:extractDeepLinksRelease UP-TO-DATE
Task :unityLibrary:packageReleaseResources UP-TO-DATE
Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:packageReleaseResources UP-TO-DATE
Task :unityLibrary:processReleaseManifest UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:extractDeepLinksRelease UP-TO-DATE
Task :unityLibrary:compileReleaseLibraryResources UP-TO-DATE
Task :unityLibrary:parseReleaseLocalResources UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:processReleaseManifest UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:parseReleaseLocalResources UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:generateReleaseRFile UP-TO-DATE
Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:compileReleaseLibraryResources UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:generateReleaseBuildConfig UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:javaPreCompileRelease UP-TO-DATE
Task :unityLibrary:generateReleaseRFile UP-TO-DATE
Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:compileReleaseJavaWithJavac UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:bundleLibCompileToJarRelease UP-TO-DATE
Task :launcher:mergeReleaseResources UP-TO-DATE
Task :launcher:processReleaseManifest UP-TO-DATE
Task :launcher:processReleaseResources UP-TO-DATE
Task :unityLibrary:compileReleaseJavaWithJavac UP-TO-DATE
Task :unityLibrary:bundleLibCompileToJarRelease UP-TO-DATE
Task :launcher:prepareLintJar UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:prepareLintJarForPublish UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:bundleLibRuntimeToJarRelease UP-TO-DATE
Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
Task :unityLibrary:bundleLibRuntimeToJarRelease UP-TO-DATE
Task :launcher:compileReleaseJavaWithJavac UP-TO-DATE
Task :launcher:compileReleaseSources UP-TO-DATE
Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:mergeReleaseShaders UP-TO-DATE
Task :unityLibrary:compileReleaseShaders NO-SOURCE> Task :unityLibrary:generateReleaseAssets UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:compileReleaseShaders NO-SOURCE
Task :unityLibrary:OneSignalConfig.plugin:generateReleaseAssets UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:packageReleaseAssets UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:processReleaseJavaRes NO-SOURCE
Task :unityLibrary:OneSignalConfig.plugin:bundleLibResRelease NO-SOURCE
Task :unityLibrary:OneSignalConfig.plugin:mergeReleaseJniLibFolders UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:mergeReleaseNativeLibs UP-TO-DATE
Task :unityLibrary:OneSignalConfig.plugin:stripReleaseDebugSymbols NO-SOURCE
Task :unityLibrary:OneSignalConfig.plugin:copyReleaseJniLibsProjectOnly UP-TO-DATE
Task :unityLibrary:packageReleaseAssets
Task :unityLibrary:processReleaseJavaRes NO-SOURCE
Task :unityLibrary:bundleLibResRelease NO-SOURCE
Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
Task :unityLibrary:mergeReleaseNativeLibs UP-TO-DATE
Task :unityLibrary:stripReleaseDebugSymbols UP-TO-DATE
Task :unityLibrary:copyReleaseJniLibsProjectOnly UP-TO-DATE
Task :launcher:lintVitalRelease
Task :launcher:checkReleaseDuplicateClasses UP-TO-DATE
Task :launcher:dexBuilderRelease UP-TO-DATE
Task :launcher:desugarReleaseFileDependencies UP-TO-DATE
Task :launcher:mergeExtDexRelease UP-TO-DATE
Task :launcher:mergeDexRelease UP-TO-DATE
Task :launcher:mergeReleaseShaders UP-TO-DATE
Task :launcher:compileReleaseShaders NO-SOURCE
Task :launcher:generateReleaseAssets UP-TO-DATE
Task :launcher:mergeReleaseAssets
Task :launcher:processReleaseJavaRes NO-SOURCE
Task :launcher:collectReleaseDependencies UP-TO-DATE
Task :launcher:sdkReleaseDependencyData UP-TO-DATE
Task :launcher:mergeReleaseJniLibFolders UP-TO-DATE
Task :launcher:mergeReleaseNativeLibs UP-TO-DATE
Task :launcher:stripReleaseDebugSymbols UP-TO-DATE
Task :launcher:validateSigningRelease UP-TO-DATE
Task :launcher:mergeReleaseJavaResource FAILED
62 actionable tasks: 4 executed, 58 up-to-date
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <5160fdea082d4c479eac116da4ffc2de>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <5160fdea082d4c479eac116da4ffc2de>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <5160fdea082d4c479eac116da4ffc2de>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at <5160fdea082d4c479eac116da4ffc2de>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action1[T] progress) (at <5160fdea082d4c479eac116da4ffc2de>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <5160fdea082d4c479eac116da4ffc2de>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5160fdea082d4c479eac116da4ffc2de>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5160fdea082d4c479eac116da4ffc2de>: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 <5160fdea082d4c479eac116da4ffc2de>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5160fdea082d4c479eac116da4ffc2de>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at <5160fdea082d4c479eac116da4ffc2

问题的出现
之前都一切正常,我下载了AndroidStudio之后,打包报错。
痛苦经历
1,卸载AndroidStudio,重装unity
2,重装系统(因为我第一次下载AndroidStudio,跟着网上教程来搞一大堆配置,其实并不需要。开去下载,也可以镜像。我直接选择前者)
3,新建密钥(不会建然后放弃了)
4,升级版本(我尝试用2022.3.8打空包可以打出来,然后将项目从2021.3.12升级到2021.3.29,仍打包报错)
问题解决
升级到了2021.3.29之后我就没降回去了,在C:\Users\你的用户名.android,把debug.keystore和debug.keystore.lock两个文件删掉
泪奔 呜呜呜呜

你可能感兴趣的:(unity开发中的踩坑点,android,unity,c#)