繁体   English   中英

Unity Gradle构建失败

[英]Unity gradle build failed

我无法在Unity中构建另一个APK。 总是相同的错误。

CommandInvokationFailure: Gradle build failed. 
C:/Program Files/Java/jdk1.8.0_171\bin\java.exe -classpath "C:\Program Files\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'.
> You have not accepted the license agreements of the following SDK components:
  [Android SDK Build-Tools 27.0.1].
  Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
  Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

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

BUILD FAILED in 1s
]
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 C:\Users\m-pro\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

Checking the license for package Android SDK Build-Tools 27.0.1 in C:\Users\m-pro\AppData\Local\Android\Sdk\licenses
Warning: License for package Android SDK Build-Tools 27.0.1 not accepted.
]
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)

我的设置和尝试过的事情:

  • JDK版本1.8

  • SDK构建工具版本25

  • 我试图将“ -dontwarn com.google.vr.ndk.base.DaydreamApi”复制到proguard文件中(在某处看到了这种解决方案)

  • 从gradle构建交换到内部构建(内部构建时会出现不同的错误)

  • 重新安装所有并重新启动计算机:D

构建工具更新后,我的Unity构建也遇到了同样的问题,因此您可能也需要更新它们。

如错误消息中所述,您需要使用android studio接受服务条款

You have not accepted the license agreements of the following SDK components: [Android SDK Build-Tools 27.0.1]. Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.

  • 在您的PC上安装Android Studio (如果尚未安装)
  • 运行其SDK管理器(配置> SDK管理器> SDK工具)
  • 如果Android SDK生成工具显示“未安装”,请单击其旁边的复选框以进行安装。

  • 如果显示“更新可用”,请单击旁边带有“-”的复选框,以便显示“✓”

  • 点击申请,并接受协议。

那就是为我解决的问题,希望它也对您有用!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM