打包Android时报错

在用Unity2018打包Android时出现了错误:
在这里插入图片描述
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -classpath “D:\unity2018.3.0f2\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:
A problem occurred configuring root project ‘gradleOut’.

Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.2 Android SDK Build-Tools 28.0.2
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html**

Using Android SDK: D:\RuanJian\sdk-new-2\sdk

  • 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 5s
]
stdout[
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (28.0.2) for Android Gradle Plugin 3.2.0.
Android SDK Build Tools 28.0.2 will be used.
To suppress this warning, remove “buildToolsVersion ‘25.0.3’” from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Observed package id ‘build-tools;19.0.3’ in inconsistent location ‘D:\RuanJian\sdk-new-2\sdk\build-tools\android-4.4.2’ (Expected ‘D:\RuanJian\sdk-new-2\sdk\build-tools\19.0.3’)
Observed package id ‘system-images;android-19;default;armeabi-v7a’ in inconsistent location ‘D:\RuanJian\sdk-new-2\sdk\system-images\android-19\armeabi-v7a’ (Expected ‘D:\RuanJian\sdk-new-2\sdk\system-images\android-19\default\armeabi-v7a’)
Observed package id ‘build-tools;19.0.3’ in inconsistent location ‘D:\RuanJian\sdk-new-2\sdk\build-tools\android-4.4.2’ (Expected ‘D:\RuanJian\sdk-new-2\sdk\build-tools\19.0.3’)
Observed package id ‘system-images;android-19;default;armeabi-v7a’ in inconsistent location ‘D:\RuanJian\sdk-new-2\sdk\system-images\android-19\armeabi-v7a’ (Expected ‘D:\RuanJian\sdk-new-2\sdk\system-images\android-19\default\armeabi-v7a’)
Checking the license for package Android SDK Build-Tools 28.0.2 in D:\RuanJian\sdk-new-2\sdk\licenses
Warning: License for package Android SDK Build-Tools 28.0.2 not accepted.
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at :0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action1[T] progress) (at :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 :0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

主要原因是因为SDK版本太低,用28.0.2以上的版本才可以解决在这个问题。

你可能感兴趣的:(Unity)