Search Issue Tracker

Fixed in 2018.2.X

Votes

0

Found in

2018.2.0b7

2018.2.0b10

Issue ID

1054208

Regression

Yes

Build fails with NDK is not found when choosing to Build & Run on Android

Mobile

-

Reproduction steps:
1. Download "EntityBug.zip" project and open in Unity
2. Go to File -> Build and Run

Expected: the project is built
Actual: the building process fails

Reproduced on: 2018.2.0b7; 2018.2.0f2
Not reproduced with: 2018.1.9f1; 2018.2.0b6
Regression introduced: 2018.2.0b7

Reproduced with:
Samsung Galaxy S6, Android: 7.0

Note:
Works fine when choosing just to Build.
Error:
Failed running C:\Users\UnityAndroid\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.burst@0.2.4-preview.17\.Runtime\bcl.exe @C:\Users\UNITYA~1\AppData\Local\Temp\tmp1a8b66bc.tmp

stdout:
An unexpected exception occurred:
System.Exception: Android NDK not found. Make sure environment variable ANDROID_NDK_ROOT is not empty.
at Unity.IL2CPP.Building.ToolChains.Android.AndroidNDKUtilities.GetNdkRootDir()
at Unity.IL2CPP.Building.ToolChains.Android.AndroidNDKUtilities..ctor(NPath ndkRootPath, Architecture architecture)
at Unity.IL2CPP.Building.ToolChains.AndroidToolChain..ctor(Architecture architecture, BuildConfiguration buildConfiguration, Boolean treatWarningsAsErrors, NPath toolchainPath)
at Unity.IL2CPP.Building.Platforms.AndroidPlatformSupport.MakeCppToolChain(BuildingOptions buildingOptions)
at Burst.Compiler.IL.Aot.AotLinker..ctor(TargetPlatform aotPlatform, TargetCpu targetCpu, List`1 pluginFolders)
at Burst.Compiler.IL.Aot.AotCompiler.Link(Module module, AotCompilerOptions compilerOptions)
at Burst.Bcl.Program.Main(String[] args)
stderr:

UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:128)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action`1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
UnityEditorInternal.Runner:RunManagedProgram(String, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:45)
Unity.Burst.Editor.BurstAotCompiler:OnPostBuildPlayerScriptDLLs(BuildReport) (at C:/Users/UnityAndroid/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.burst@0.2.4-preview.17/Editor/BurstAotCompiler.cs:189)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

Comments (9)

  1. wanorde23

    Aug 17, 2021 11:18

    Had this problem with unity 2019.4.10.f1 after adding the Animation rigging package. Fixed it by changing some folders at:

    /Applications/Unity/Hub/Editor/2019.4.10f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64

    I copied the darwin folder and renamed the copy: linux-x86_64

    then I did the same at:

    /Applications/Unity/Hub/Editor/2019.4.10f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64

    Now it builds again I have not tested the Animation rigging package jet though.

  2. unity-huunity

    Dec 30, 2019 06:12

    This issue happened with 2019.1.8f1 after adding packages:
    2D Animation preview.7 - 2.1.0
    2D IK preview.1 - 1.1.0
    Removing those packages solve the problem

  3. FuDaNing

    Sep 23, 2019 03:53

    Found in 2018.4.9

  4. derElbi

    Aug 27, 2019 22:08

    Still happens, using Unity 2019.1.14f1 on High Sierra.

  5. toopballgame

    May 20, 2019 05:31

    Same issu with empty project on Android platform.

  6. joa-baur

    May 16, 2019 11:07

    Definitely was not fixed for me either, but I found a workaround:

    The NDK is installed by the Hub here on my machine:

    /Applications/Unity/Hub/Editor/2019.1.0f2/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r16b/

    For the error to go away, I just moved all the files from within the "android-ndk-r16b" folder directly into the ".../AndroidPlayer/NDK/"-folder. Seems like the build system does not expect the "android-ndk-r16b" subfolder there...

  7. ncallaway

    May 13, 2019 21:18

    Just ran into this same issue.

    ```
    Unhandled Exception: System.Exception: Android NDK r13b or newer not detected at '/Applications/Unity/Hub/Editor/2019.1.0f2/PlaybackEngines/AndroidPlayer/NDK'.
    at Unity.IL2CPP.Building.ToolChains.Android.AndroidNDKUtilities..ctor(NPath ndkRootPath, Architecture architecture, Boolean useDependenciesToolChain)
    at Unity.IL2CPP.Building.ToolChains.AndroidToolChain..ctor(Architecture architecture, BuildConfiguration buildConfiguration, Boolean treatWarningsAsErrors, Boolean assemblyOutput, Boolean useDependenciesToolChain, NPath toolchainPath)
    at Unity.IL2CPP.Building.Platforms.AndroidPlatformSupport.MakeCppToolChain(BuildingOptions buildingOptions)
    at il2cpp.Program.DoRun(String[] args)
    at il2cpp.Program.Run(String[] args)
    at il2cpp.Program.Main(String[] args)
    at Program.Main(String[] args)
    - IL2CPP
    Exception: Exception: /Applications/Unity/Hub/Editor/2019.1.0f2/Unity.app/Contents/il2cpp/build/il2cppcore/il2cppcore.dll did not run properly! - IL2CPP
    ```

    Updating to Unity Hub 2.0.0 for some reason deleted my existing Android SDK/NDK such that unity could no longer find it. When I used Unity Hub 2.0.0 to reinstall the SDK and NDK, Unity says the NDK is found, but the build still fails with the error above.

    There is definitely an NDK at that location.

    ```
    ls /Applications/Unity/Hub/Editor/2019.1.0f2/PlaybackEngines/AndroidPlayer/NDK
    android-ndk-r16b
    ```

    Unity Hub both deleted my working NDK, and then installed a non-working NDK. And I didn't even want it to update!

  8. Stevens-R-Miller

    May 02, 2019 13:54

    Essentially the same error with 2019.1.0f2:

    il2cpp.exe didn't catch exception: System.Exception: Android NDK r13b or newer not detected at 'C:\Program Files\Unity\Hub\Editor\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer\NDK'.

    Except I installed it and it is there.

  9. firatcetiner

    Feb 19, 2019 17:32

    Well this issue certainly is not fixed. Encountering the same issue with 2018.3.2f1.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.