유니티에서 안드로이드 APK 파일을 만들 때 아래와 같이 오류가 3개 발생한다.
조치 방법
- Unity -> Edit -> Preference 에서 External Tools를 선택한다.
- NDK 우측에 있는 Download 버튼을 클릭해 NDK를 다운로드한다.
- 다운받은 NDK의 압축을 푼다.
- 압축을 푼 폴더의 toolchains 폴더를 Android sdk가 설치된 폴더의 ndk-bundle 폴더 아래에 복사한다.
단, 복사 시 이미 폴더가 있을 수 있으므로 기존에 있는 toolchains 폴더는 다른 이름으로 변경한다. - 주의) Unity Preferences에서 NDK 폴더는 비워 둔다.
- 다시 Build And Run을 하면 오류 없이 컴파일되고 실행된다.
--------------------------------------------------------------------------------------------------------------------------------
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Java\jdk1.8.0_144\bin\java.exe -classpath
"E:\Program Files\Unity2018210f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.1.jar"
org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleDebug"
stderr[
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'gradleOut'.
> No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 11s
]
stdout[
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
]
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 (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1 progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, 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)
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0021f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:187
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:94
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)