mac上unity2017设置Android打包

ZeroKing 2020-03-07

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

mac上unity2017设置Android打包

 

mac上unity2017设置Android打包

 

 

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

mac上unity2017设置Android打包

 

 

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打包

相关推荐

爱文学更爱编程 / 0评论 2020-08-01