gpt4 book ai didi

java - Unity Jenkins Android Gradle Task :mergeReleaseResources FAILED, 命令行工作正常

转载 作者:行者123 更新时间:2023-12-01 22:17:22 28 4
gpt4 key购买 nike

我正在尝试设置 Jenkins 服务器以自动构建 Unity,但出现 gradle 错误。

使用命令行构建工作正常,但如果尝试使用 Jenkins 则会失败。

日志:

失败:构建因异常而失败。

  • 出了什么问题:任务“:mergeReleaseResources”执行失败。

    8 exceptions were raised by workers: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #7: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #4: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #3: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #6: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #5: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #2: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #1: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #0: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does.

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • 获取更多帮助:https://help.gradle.org

4秒内构建失败]标准输出[

Task :preBuild UP-TO-DATE

Task :preReleaseBuild

Task :compileReleaseAidl NO-SOURCE

Task :compileReleaseRenderscript NO-SOURCE

Task :checkReleaseManifest

Task :generateReleaseBuildConfig

Task :prepareLintJar

Task :generateReleaseSources

Task :javaPreCompileRelease

Task :mainApkListPersistenceRelease

Task :generateReleaseResValues

Task :generateReleaseResources

Task :mergeReleaseResources FAILED

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);

}

}

构建的 Unity 参数:

-quit -batchMode -executeMethod AutomateBuildProcess.StartBuild -logFile D:/Editor.log

Jenkins 在 Windows 10 计算机上运行。

最佳答案

如果您使用的是 Windows,只需将 Jenkins 服务的“登录身份”更改为我的帐户即可解决此问题。

如何解决:

  1. 开放系统服务

  2. 查找 Jenkins 服务 enter image description here

  3. 将登录用户从本地系统更改为帐户 enter image description here

关于java - Unity Jenkins Android Gradle Task :mergeReleaseResources FAILED, 命令行工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58615694/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com