Unity Jenkins Android Gradle 任务:mergeReleaseResources FAILED,命令行工作正常
Posted
技术标签:
【中文标题】Unity Jenkins Android Gradle 任务:mergeReleaseResources FAILED,命令行工作正常【英文标题】:Unity Jenkins Android Gradle Task :mergeReleaseResources FAILED, Command line working fine 【发布时间】:2020-02-25 04:20:47 【问题描述】:我正在尝试设置 Jenkins 服务器以自动构建 Unity,但出现 gradle 错误。
使用命令行构建工作正常,但如果尝试使用 Jenkins,则会失败。
日志:
FAILURE:构建失败并出现异常。
出了什么问题: 任务 ':mergeReleaseResources' 执行失败。
工人提出了 8 个例外: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows 守护进程 #7: 守护进程启动失败 这在正常情况下不应该发生,如果发生,请提出问题。 com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows 守护进程 #4: 守护进程启动失败 这在正常情况下不应该发生,如果发生,请提出问题。 com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.0-5326820-windows 守护进程#3:守护进程启动失败 这在正常情况下不应该发生,如果发生,请提出问题。 com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows 守护进程 #6: 守护进程启动失败 这在正常情况下不应该发生,如果发生,请提出问题。 com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows 守护进程 #5: 守护进程启动失败 这在正常情况下不应该发生,如果发生,请提出问题。 com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.0-5326820-windows 守护进程 #2:守护进程启动失败 这在正常情况下不应该发生,如果发生,请提出问题。 com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.0-5326820-windows 守护进程 #1:守护进程启动失败 这在正常情况下不应该发生,如果发生,请提出问题。 com.android.builder.internal.aapt.v2.Aapt2InternalException:AAPT2 aapt2-3.4.0-5326820-windows 守护进程#0:守护进程启动失败 这在正常情况下不应该发生,如果发生请提出问题。
尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
通过https://help.gradle.org获得更多帮助
4 秒内构建失败 ] 标准输出[
任务:preBuild UP-TO-DATE
任务:preReleaseBuild
任务:compileReleaseAidl NO-SOURCE
任务:compileReleaseRenderscript NO-SOURCE
任务:checkReleaseManifest
任务:generateReleaseBuildConfig
任务:prepareLintJar
任务:generateReleaseSources
任务:javaPreCompileRelease
任务:mainApkListPersistenceRelease
任务:generateReleaseResValues
任务:generateReleaseResources
任务:mergeReleaseResources 失败
8 actionable tasks: 8 executed
]
exit code: 1
at UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00031] in <24d9b022aa584914af833273ea899103>:0
at UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00015] in <24d9b022aa584914af833273ea899103>:0
at UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x0000a] in <24d9b022aa584914af833273ea899103>:0
at UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) [0x0001f] in <24d9b022aa584914af833273ea899103>:0
at UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) [0x00029] in <24d9b022aa584914af833273ea899103>:0
Rethrow as GradleInvokationException: Gradle build failed
at UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) [0x0004d] in <24d9b022aa584914af833273ea899103>:0
at UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x000a8] in <24d9b022aa584914af833273ea899103>:0
at UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00074] in <24d9b022aa584914af833273ea899103>:0
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
at UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) [0x0001e] in <24d9b022aa584914af833273ea899103>:0
at UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00110] in <24d9b022aa584914af833273ea899103>:0
at 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) [0x002c8] in <24d9b022aa584914af833273ea899103>:0
at UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) [0x00001] in <24d9b022aa584914af833273ea899103>:0
at 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) [0x000da] in C:\buildslave\unity\build\Editor\Mono\BuildPipeline\PostprocessBuildPlayer.cs:281
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions) (at C:\buildslave\unity\build\Editor\Mono\BuildPipeline.bindings.cs:368)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions) (at C:\buildslave\unity\build\Editor\Mono\BuildPipeline.bindings.cs:267)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at C:\buildslave\unity\build\Editor\Mono\BuildPipeline.bindings.cs:250)
AutomateBuildProcess:StartBuild() (at Assets\[ProjectName]\Scripts\Utility\Editor\AutomateBuildProcess.cs:35)
(Filename: <24d9b022aa584914af833273ea899103> Line: 0)
构建脚本:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using System.IO.Compression;
public class AutomateBuildProcess
private static string BuildsFolder = "D:/GDP/Jenkins/workspace/[ProjectName]/Builds/";
public static void StartBuild()
List<string> enabledScenePathNames = new List<string>();
foreach (var scene in EditorBuildSettings.scenes)
if (scene.enabled)
enabledScenePathNames.Add(scene.path);
string buildNumber = "GradleFixTest"; //Environment.GetEnvironmentVariable("BUILD_NUMBER");
string _fileName = "[ProjectName]_" + buildNumber + ".apk";
Debug.Log("Starting android build");
BuildPlayerOptions newBuildPlayerOptions = new BuildPlayerOptions();
newBuildPlayerOptions.scenes = enabledScenePathNames.ToArray();
newBuildPlayerOptions.locationPathName = BuildsFolder + _fileName;
newBuildPlayerOptions.target = BuildTarget.Android;
newBuildPlayerOptions.targetGroup = BuildTargetGroup.Android;
newBuildPlayerOptions.options = BuildOptions.None;
BuildPipeline.BuildPlayer(newBuildPlayerOptions);
用于构建的统一参数:
-quit -batchMode -executeMethod AutomateBuildProcess.StartBuild -logFile D:/Editor.log
Jenkins 在 Windows 10 机器上运行。
【问题讨论】:
找到任何解决方案了吗?在我的情况下同样的问题。 【参考方案1】:在我的情况下,这个问题是由使用具有有限权限的 windows 用户引起的。通过切换到管理员用户修复。
【讨论】:
【参考方案2】:如果您使用的是windows,只需将Jenkins服务的“登录身份”更改为我的帐户即可解决此问题。
如何解决:
打开系统服务
找到詹金斯服务
将登录用户从本地系统更改为帐户
【讨论】:
以上是关于Unity Jenkins Android Gradle 任务:mergeReleaseResources FAILED,命令行工作正常的主要内容,如果未能解决你的问题,请参考以下文章