Unity3D:CommandInvokationFailure: Gradle build failed.

问题:

CommandInvokationFailure: Gradle build failed. 
C:\ProgramFiles\Java\jdk1.8.0_131\bin\java.exe-classpath "D:\unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'gradleOut'.
> Failed to find Build Tools revision 28.0.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED in 2s
]
stdout[
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to D:\sdk\android-sdk-windows\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

Observed package id 'build-tools;28.0.0-rc1' in inconsistent location 'D:\sdk\android-sdk-windows\build-tools\28.0.0-preview' (Expected 'D:\sdk\android-sdk-windows\build-tools\28.0.0-rc1')
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1 progress, System.String error)
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)


解决办法:

将下图中红色的框中的选项改为  Internal

Unity3D:CommandInvokationFailure: Gradle build failed._第1张图片

修改之后

Unity3D:CommandInvokationFailure: Gradle build failed._第2张图片

直接build,就可以生成.apk

你可能感兴趣的:(Unity,3D)