il2cpp android build error 2019.2.19f1
I am having a tough time with my Android build. The 32 bit mono apk worked, but google play requires a 64 bit version. The iOS build went fine as well. As soon as I switched to il2cpp I started having build errors. I've tried read the build log, and have searched the forums, trying lot's of solutions, but nothing seems to work.
I've tried internal build as well as gradle. I'm unchecked all architectures except 64 bit. I've deleted the Library folder, deleted .sln files, deleted Temp folder.
I'm on a mac and I have Admin privileges. I have the latest version of unity as well as the android sdk/ndk from unity install.
If anyone could look at this log, I have no idea what to try next.
Failed running /Applications/Unity/Hub/Editor/2019.2.9f1/Unity.app/Contents/il2cpp/build/il2cppcore/il2cppcore.dll --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="Android" --architecture="ARM64" --configuration="Release" --outputpath="/Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Temp/StagingArea/assets/bin/Data/Native/arm64-v8a/libil2cpp.so" --cachedirectory="/Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Assets/../Library/il2cpp_android_arm64-v8a/il2cpp_cache" --additional-include-directories="/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/Tools/bdwgc/include" --additional-include-directories="/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/Tools/libil2cpp/include" --tool-chain-path="/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK" --profiler-report --map-file-parser="/Applications/Unity/Hub/Editor/2019.2.9f1/Unity.app/Contents/Tools/MapFileParser/MapFileParser" --directory="/Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Temp/StagingArea/assets/bin/Data/Managed" --generatedcppdir="/Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Temp/StagingArea/Il2Cpp/il2cppOutput"
stdout:
Building libil2cpp.so with AndroidToolChain
Output directory: /Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Temp/StagingArea/assets/bin/Data/Native/arm64-v8a
Cache directory: /Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Library/il2cpp_android_arm64-v8a/il2cpp_cache
il2cpp.exe didn't catch exception: Unity.IL2CPP.Building.BuilderFailedException:
Invocation was: Executable: /Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
Arguments: -DNET_4_0 -DUNITY_AOT -DIL2CPP_MONO_DEBUGGER_DISABLED -DGC_NOT_DLL -DRUNTIME_IL2CPP -DLINUX -DANDROID -DPLATFORM_ANDROID -D__linux__ -D__STDC_FORMAT_MACROS -DTARGET_ARM64 -I"/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/Tools/bdwgc/include" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/Tools/libil2cpp/include" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/Unity.app/Contents/il2cpp/libil2cpp" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/Unity.app/Contents/il2cpp/libil2cpp" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/Unity.app/Contents/il2cpp/external/bdwgc/include" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/Unity.app/Contents/il2cpp/external/xxHash" -I"/Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Temp/StagingArea/Il2Cpp/il2cppOutput" -I"." -I"/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/sources/cxx-stl/gnu-libstdc++/4.9/include" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/sources/cxx-stl/gnu-libstdc++/4.9/include/backward" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include" -c -g -DNDEBUG -fexceptions -fno-limit-debug-info -fdata-sections -ffunction-sections -Wa,--noexecstack -fno-rtti -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -fno-strict-overflow -fPIC -Os --sysroot "/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/sysroot" -gcc-toolchain "/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64" -target aarch64-none-linux-android -isystem "/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/sysroot/usr/include/aarch64-linux-android" -D__ANDROID_API__=21 -march=armv8-a -Wno-unused-value "/Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Temp/StagingArea/Il2Cpp/il2cppOutput/Il2CppTypeDefinitions.c" -o "/Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Library/il2cpp_android_arm64-v8a/il2cpp_cache/8A15DEF812BF88C42E113A4EB09E0CA9.o"
at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)
at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
at il2cpp.Program.DoRun(String[] args)
at il2cpp.Program.Run(String[] args)
at il2cpp.Program.Main(String[] args)
stderr:
Unhandled Exception: Unity.IL2CPP.Building.BuilderFailedException:
Invocation was: Executable: /Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
Arguments: -DNET_4_0 -DUNITY_AOT -DIL2CPP_MONO_DEBUGGER_DISABLED -DGC_NOT_DLL -DRUNTIME_IL2CPP -DLINUX -DANDROID -DPLATFORM_ANDROID -D__linux__ -D__STDC_FORMAT_MACROS -DTARGET_ARM64 -I"/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/Tools/bdwgc/include" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/Tools/libil2cpp/include" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/Unity.app/Contents/il2cpp/libil2cpp" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/Unity.app/Contents/il2cpp/libil2cpp" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/Unity.app/Contents/il2cpp/external/bdwgc/include" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/Unity.app/Contents/il2cpp/external/xxHash" -I"/Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Temp/StagingArea/Il2Cpp/il2cppOutput" -I"." -I"/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/sources/cxx-stl/gnu-libstdc++/4.9/include" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/sources/cxx-stl/gnu-libstdc++/4.9/include/backward" -I"/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include" -c -g -DNDEBUG -fexceptions -fno-limit-debug-info -fdata-sections -ffunction-sections -Wa,--noexecstack -fno-rtti -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -fno-strict-overflow -fPIC -Os --sysroot "/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/sysroot" -gcc-toolchain "/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64" -target aarch64-none-linux-android -isystem "/Applications/Unity/Hub/Editor/2019.2.9f1/PlaybackEngines/AndroidPlayer/NDK/sysroot/usr/include/aarch64-linux-android" -D__ANDROID_API__=21 -march=armv8-a -Wno-unused-value "/Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Temp/StagingArea/Il2Cpp/il2cppOutput/Il2CppTypeDefinitions.c" -o "/Users/scottmorrison/Desktop/Dev/apps/PIP/unity/Pip_R411/Library/il2cpp_android_arm64-v8a/il2cpp_cache/8A15DEF812BF88C42E113A4EB09E0CA9.o"
at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)
at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
at il2cpp.Program.DoRun(String[] args)
at il2cpp.Program.Run(String[] args)
at il2cpp.Program.Main(String[] args)
at Program.Main(String[] args) in /Users/builduser/buildslave/unity/build/External/il2cpp/il2cpp/il2cppcore/Program.cs:line 24
UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:126)
UnityEditorInternal.Runner:RunNetCoreProgram(String, String, String, CompilerOutputParserBase, Action`1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:77)
UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:501)
UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:484)
UnityEditorInternal.IL2CPPBuilder:Run() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:334)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:63)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
Answer by blamejane · Nov 09, 2019 at 02:54 AM
So I solved this by manually downloading Android NDK r16b. For some reason the Unity Hub downloaded and installed version was causing problems. I installed the NDK in a different directory and pointed the Unity -> preferences -> External Tools -> NDK directory to this new install.
Immediately was able to Export for Android Studio as well as build the APK for Google Play within Unity. Freakin' Yay!
Your answer
Follow this Question
Related Questions
IL2CPP did not run probbably,IL2CPP Did not run probbably 0 Answers
Failed running Android build with il2CPP with Unity 2019.2.11f1 2 Answers
Can't Build with IL2CPP for Android after 2018.3.0 Update(Empty Project) 1 Answer
Unable to generate 64 bit android apk for Unity project 0 Answers
Android build error 1 Answer