打包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 <e1c3953b4cf040ddb1400046b1c34897>: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以上的版本才可以解决在这个问题。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值