我无法在Unity中构建另一个APK。总是同样的错误.SO:Win 10 64位Unity版本:2018.3.9f1与Android构建工具。
我创建了一个空的项目,只有按钮,我试图导出apk尝试,但我得到这个错误>>>。
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_251\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
stderr[
FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture snapshot of output files for task ':mergeReleaseAssets' property 'outputDir' during up-to-date check.
> Failed to create MD5 hash for file 'D:\Unity\TEST Game\test project\Temp\gradleOut\build\intermediates\merged_assets\release\mergeReleaseAssets\out\bin\Data\Managed\etc\mono\2.0\DefaultWsdlHelpGenerator.aspx' as it does not exist.
* 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 24s
]
stdout[
:checkReleaseClasspath UP-TO-DATE
:preBuild UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:compileReleaseAidl NO-SOURCE
:compileReleaseRenderscript UP-TO-DATE
:checkReleaseManifest UP-TO-DATE
:generateReleaseBuildConfig UP-TO-DATE
:prepareLintJar UP-TO-DATE
:mainApkListPersistenceRelease UP-TO-DATE
:generateReleaseResValues UP-TO-DATE
:generateReleaseResources UP-TO-DATE
:mergeReleaseResources UP-TO-DATE
:createReleaseCompatibleScreenManifests UP-TO-DATE
:processReleaseManifest
:splitsDiscoveryTaskRelease UP-TO-DATE
:processReleaseResources
:generateReleaseSources
:javaPreCompileRelease UP-TO-DATE
:compileReleaseJavaWithJavac UP-TO-DATE
:compileReleaseNdk NO-SOURCE
:compileReleaseSources UP-TO-DATE
:lintVitalRelease
:mergeReleaseShaders UP-TO-DATE
:compileReleaseShaders UP-TO-DATE
:generateReleaseAssets UP-TO-DATE
:mergeReleaseAssets FAILED
19 actionable tasks: 4 executed, 15 up-to-date
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <df7ba4d130594d168eec372b930522d4>: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 <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <df7ba4d130594d168eec372b930522d4>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
我的设置和我试过的东西。
JDK版本1.8
SDK构建工具版本25
从Gradle构建切换到内部构建(因为内部构建会出现不同的错误)。
重新安装所有的东西,然后重启电脑,问题还是出现了。
你需要在手机程序员选项中启用usb调试功能
这是一个奇怪的错误,好像和Unity没有具体关系。
进程无法找到这个文件。DefaultWsdlHelpGenerator
.
...'D:\Unity\TEST Game\test project\Temp\gradleOut\build\...\etc\mono\2.0\DefaultWsdlHelpGenerator.aspx' as it does not exist.
位于你的项目文件夹内的文件。D:\Unity\TEST Game\test project
作为一个不喜欢路径上有空格的人,我建议你用另一个不在路径上有空格的项目来试试,根据你的评论,这就成功了!
ps;由于这个可能对别人有帮助,我把这个写成答案!