gpt4 book ai didi

c# - Unity gradle 构建失败

转载 作者:行者123 更新时间:2023-12-03 04:21:54 26 4
gpt4 key购买 nike

我无法在 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 接受 TOS
    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.

  • Install Android studio在您的 PC 上(如果您还没有的话)
  • 运行其 SDK 管理器(配置 > SDK 管理器 > SDK 工具)
  • 如果 Android SDK 构建工具显示“未安装”,请单击它旁边的复选框进行安装。
  • 如果显示“更新可用”,请单击旁边带有“-”的复选框,以显示“✓”
  • 点击申请,并接受协议(protocol)。

  • 这就是为我解决的问题,希望这也对你有用!

    关于c# - Unity gradle 构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49987126/

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