码迷,mamicode.com
首页 > 移动开发 > 详细

mac上unity2017设置Android打包

时间:2020-03-07 13:09:46      阅读:367      评论:0      收藏:0      [点我收藏+]

标签:des   contex   ble   ges   fail   machines   lib   process   user   

1. 下载Android SDK:通过下载Android Studio进行安装,但是下载Android Studio 3.6.1版本后,SDK Manage有变化。Unity打包需要的SDK Tools被Obsolete了,需要把Hide Obsolete Packages的勾选去掉才能看到。

技术图片

 

技术图片

 

 

 2. 安装SDK Build-Tools 30-rc1之后,/Users/xxx/Library/Android/sdk/build-tools目录下,30-rc1的目录名称是30.0.0-rc1,会导致Unity打包会报错。

技术图片

 

 

CommandInvokationFailure: Gradle build failed. 
/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin/java -classpath "/Users/jerryqin/Desktop/KH/Unity17EditorApp/MacEditor/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 find Build Tools revision 30.0.0

* 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 3s
]
stdout[

]
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)

有两种解决方法:

   解决方法1:把 30.0.0-rc1 目录改名为 30.0.0就可以

   解决方法2:修改 Unity安装目录下的文件 /PlaybackEngines/AndroidPlayer/Tools/GradleTemplates/mainTemplate.gradle,改成其他版本的。

技术图片

mac上unity2017设置Android打包

标签:des   contex   ble   ges   fail   machines   lib   process   user   

原文地址:https://www.cnblogs.com/qinruijie/p/12433336.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!