Search Unity

Build for android (IL2CPP) failed with "Unable to detect NDK version"

Discussion in 'Unity Cloud Build' started by United-Unity, Dec 22, 2015.

Thread Status:
Not open for further replies.
  1. United-Unity

    United-Unity

    Joined:
    Mar 25, 2015
    Posts:
    20
    Build for android (with experimental IL2CPP) failed with
    IL2CPP for android needs android NDK for compiling generated C++ sources but it seems that unity builder machines don't have it and this might be the reason for the build failure.

    Although IL2CPP for android is still an experimental feature but it's nice to have it.
     
  2. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    660
    Yes you need Android NDK when you want to build an Android app with Unity using IL2CPP. If you have build machines with Unity (using headless mode) to build the build, each of the slaves will ned the NDK, SDK, JDK, installed as well. What exactly do you mean by "unity builder machines"? :)
     
  3. United-Unity

    United-Unity

    Joined:
    Mar 25, 2015
    Posts:
    20
  4. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    757
    The Android NDK currently isn't available on Unity Cloud Build (which means IL2CPP android builds will fail). It is something that we are working to have ready to release. Should be available in the near(ish) future.
     
  5. United-Unity

    United-Unity

    Joined:
    Mar 25, 2015
    Posts:
    20
    Thanks for sharing future plan. I hope that it will arrive soon. :)
     
  6. Immanuel-Scholz

    Immanuel-Scholz

    Joined:
    Jun 8, 2013
    Posts:
    217
    "Nearish future" appears to be still the future.. any progress here?
     
  7. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    236
    Hey @Immanuel Scholz
    Android NDK was added to Unity Cloud Build a bit ago. Give it a shot. Keep in mind that Android IL2CPP building is still a beta feature in the editor.
     
  8. Immanuel-Scholz

    Immanuel-Scholz

    Joined:
    Jun 8, 2013
    Posts:
    217
    I gave it a shot, found the error message of the OP, googled and came to this forum entry :(

    Build target is 5.4.0b17, Android with IL2CPP activated.

    there's a suspicious error at the start of the log about a rubygems problem:

    Code (csharp):
    1.  
    2. 1: Running Prebuild steps
    3. 2: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'bvr' (>= 0) among 41 total gem(s) (Gem::LoadError)
    4. 3: from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
    5. 4: from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
    6. 5: from /usr/bin/bvr:22:in `<main>'
    7. 6: ERROR: While executing gem ... (OptionParser::MissingArgument)
    8. 7: missing argument: --version
    9. 8: Building native extensions. This could take a while...
    10.  
    At the end of the log, there comes the error with the NDK:

    Code (csharp):
    1. 2367: [Unity] UnityEditor.Android.PostProcessAndroidPlayer:PostProcess(BuildTarget, String, String, String, String, String, String, BuildOptions, RuntimeClassRegistry)
    2. 2368: [Unity] UnityEditor.Android.AndroidBuildPostprocessor:PostProcess(BuildPostProcessArgs)
    3. 2369: [Unity] UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, BuildTarget, BuildOptions, Boolean)
    4. 2370: [Unity] UnityEditor.CloudBuild.Builder:Build()
    5. 2371: [Unity] UnityException: Unable to detect NDK version, please pick a different folder.
    6. 2372: [Unity] at UnityEditor.Android.AndroidNdkRoot.VerifyNdkDir (System.String ndkPath) [0x00000] in <filename unknown>:0
    7. 2373: [Unity] at UnityEditor.Android.AndroidNDKTools.GetInstance () [0x00000] in <filename unknown>:0
    8. 2374: [Unity] at UnityEditor.Android.AndroidIl2CppClangCompiler..ctor (.TargetArchCompilerSettings[] targetArchitectures, System.String unityEngineVariation) [0x00000] in <filename unknown>:0
    9. 2375: [Unity] at UnityEditor.Android.AndroidIl2CppPlatformProvider.CreateNativeCompiler () [0x00000] in <filename unknown>:0
    10. 2376: [Unity] at UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.PrepareIl2cppFiles (UnityEditor.Android.PostProcessor.PostProcessorContext context, UnityEditor.Android.AndroidIl2CppPlatformProvider provider) [0x00000] in <filename unknown>:0
    11. 2377: [Unity] at UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00000] in <filename unknown>:0
    12. 2378: [Unity] at UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00000] in <filename unknown>:0
    13. 2379: [Unity] at UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) [0x00000] in <filename unknown>:0
    14. 2380: [Unity] at UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args) [0x00000] in <filename unknown>:0
    15. 2381: [Unity] UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, BuildTarget, BuildOptions, Boolean)
    16. 2382: [Unity] UnityEditor.CloudBuild.Builder:Build()
    17. 2383: [Unity] Error building Player: UnityException: Unable to detect NDK version, please pick a different folder.
    18. 2384: [Unity] (Filename: Line: -1)
    19. 2385: [Unity] Load scene 'Temp/__Backupscenes/0.backup' time: 0.031493 ms
    20. 2386: [Unity] Unloading 23 Unused Serialized files (Serialized files now loaded: 0)
    21. 2387: [Unity] System memory in use before: 89.9 MB.
    22. 2388: [Unity] System memory in use after: 90.1 MB.
    23. 2389: [Unity] Unloading 5 unused Assets to reduce memory usage. Loaded Objects now: 2836.
    24. 2390: [Unity] Total: 13.210633 ms (FindLiveObjects: 0.290454 ms CreateObjectMapping: 0.056934 ms MarkObjects: 12.823046 ms DeleteObjects: 0.038838 ms)
    25. 2391: [Unity] Unloading 14 Unused Serialized files (Serialized files now loaded: 0)
    26. 2392: [Unity] System memory in use before: 98.7 MB.
    27. 2393: [Unity] System memory in use after: 98.9 MB.
    28. 2394: [Unity] Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 2849.
    29. 2395: [Unity] Total: 11.146170 ms (FindLiveObjects: 0.267356 ms CreateObjectMapping: 0.022022 ms MarkObjects: 10.847215 ms DeleteObjects: 0.008495 ms)
    30. 2396: [Unity] Ignoring '/UNITY_PATH/Unity/Unity-5_4_0b17/Unity.app/Contents/UnityExtensions/Unity/Advertisements/UnityEngine.Advertisements.dll' because we're compiling for Editor
    31. 2397: [Unity] Ignoring '/UNITY_PATH/Unity/Unity-5_4_0b17/Unity.app/Contents/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll' because we're compiling for Editor
    32. 2398: [Unity] Ignoring '/UNITY_PATH/Unity/Unity-5_4_0b17/Unity.app/Contents/UnityExtensions/Unity/UnityPurchasing/UnityEngine.Purchasing.dll' because we're compiling for Editor
    33. 2399: [Unity] Ignoring '/UNITY_PATH/Unity/Unity-5_4_0b17/Unity.app/Contents/UnityExtensions/Unity/Advertisements/UnityEngine.Advertisements.dll' because we're compiling for Editor
    34. 2400: [Unity] Ignoring '/UNITY_PATH/Unity/Unity-5_4_0b17/Unity.app/Contents/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll' because we're compiling for Editor
    35. 2401: [Unity] Ignoring '/UNITY_PATH/Unity/Unity-5_4_0b17/Unity.app/Contents/UnityExtensions/Unity/UnityPurchasing/UnityEngine.Purchasing.dll' because we're compiling for Editor
    36. 2402: [Unity] - starting compile Library/ScriptAssemblies/Assembly-CSharp.dll, for buildtarget 13
    37. 2403: [Unity] Unloading 2 Unused Serialized files (Serialized files now loaded: 0)
    38. 2404: [Unity] System memory in use before: 98.4 MB.
    39. 2405: [Unity] System memory in use after: 98.6 MB.
    40. 2406: [Unity] Unloading 2 unused Assets to reduce memory usage. Loaded Objects now: 2849.
    41. 2407: [Unity] Total: 17.406790 ms (FindLiveObjects: 1.155344 ms CreateObjectMapping: 0.055562 ms MarkObjects: 16.149696 ms DeleteObjects: 0.044253 ms)
    42. 2408: [Unity] *** Cancelled 'Build.Player.AndroidPlayer' in 90 seconds (90353 ms)
    43. 2409: [Unity] Player export failed. Reason: 2 errors
    44. 2410: [Unity] UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    45. 2411: [Unity] UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    46. 2412: [Unity] UnityEngine.Logger:Log(LogType, Object)
    47. 2413: [Unity] UnityEngine.Debug:Log(Object)
    48. 2414: [Unity] UnityEditor.CloudBuild.BuildLogger:Log(String, Object[])
    49. 2415: [Unity] UnityEditor.CloudBuild.Builder:Build()
    50. 2416: [Unity] Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.046931 seconds (Nothing changed)
    51. 2417: [Unity] Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.048067 seconds (Nothing changed)
    52. 2418: [Unity] Internal: Possible leak. All textures should be removed from IdMap when destructed using RemoveTexture(TextureID texid).
    53. 2419: [Unity] Cleanup mono
    54. 2420: [Unity] Checking for leaked weakptr:
    55. 2421: [Unity] Found no leaked weakptrs.
    56. 2422: [Unity] ##unity-automation:{"messageType":"MemoryLeaks","allocatedMemory":7808,"memoryLabels":[{"Default":96},{"Thread":48},{"Manager":216},{"GfxDevice":192},{"Physics":8},{"String":444},{"DynamicArray":48},{"ScriptManager":1800},{"VR":2912},{"EditorUtility":280},{"AssetImporter":24},{"RestService":64},{"License":972},{"UnityConnect":704}]}
    57. 2423: ! Unity player export failed!
    58. 2424: ! build of 'default-android' failed. compile failed
    59. 2425: Publishing build 92 of bananaa/yinyang for target 'default-android'...
    60. 2426: publishing finished successfully.
    61. 2427: Build step 'Execute shell' marked build as failure
    62. 2428: postbuildstatus finished successfully.
    63. 2429: Finished: FAILURE
    64.  
    Any ideas?
     
  9. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    236
    Ignore the rubygems error, it looks like the env path is not working:
    "2371: [Unity] UnityException: Unable to detect NDK version, please pick a different folder."
    I'll check with our server guys when they wake up.
     
    HamFar likes this.
  10. HamFar

    HamFar

    Joined:
    Nov 16, 2014
    Posts:
    89
    @Ryanc_unity Once you have manually installed the NDK, where do you find it, so you can browse to it and set the path in Unity? I installed it, but it is not to be found anywhere, even in my Library files...
     
  11. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    236
    Are you specifically asking about local install or cloud build?
     
    HamFar likes this.
  12. HamFar

    HamFar

    Joined:
    Nov 16, 2014
    Posts:
    89
    @Ryanc_unity Local install... I am just getting started with Unity, so I would like to configure SDK+JDK+NDK for development. I have sorted the first two, but I have no clue how to specify the NDK path.
     
  13. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    236
    If you have the Unity Editor open, go to "Edit > Preferences..." menu item. This opens up the Unity Preferences window that contains a selection of options on the left side. Select the "External Tools" option. From there you can manually type in the paths for SDK, JDK, and NDK or use the "Browse" to select the folder using the file dialog box. Or you can click the "Download" button to download and setup the version you need. If you have manually download the NDK, make sure you downloaded the correct version. You need 10e which is an older release that is found here: https://developer.android.com/ndk/downloads/older_releases.html Those downloads are zip files, so you just extract it to a location of your choosing and then just point Unity to that location. Just as an example, on my Windows machine I have my android SDK and NDK folders set up under C:\android\sdk for SDK and c:\android\ndk for NDK.
     
    bradlang and HamFar like this.
  14. executer

    executer

    Joined:
    Mar 29, 2017
    Posts:
    7
    simply remove windows x86_64 from parent folder name and then select folder inside parent folder for NDK
     
    JunaidGhani likes this.
  15. JunaidGhani

    JunaidGhani

    Joined:
    Nov 14, 2017
    Posts:
    4
    This should be F***ing written on Unity first page, i downloaded some 6 NDKS version, searched and worked for almost 2 or 3 days and you know what this solved it, thank you!
     
    DaReign likes this.
  16. Ofelia_

    Ofelia_

    Joined:
    May 10, 2019
    Posts:
    3

    I solved the problem with this video
     
  17. victorw

    victorw

    Unity Technologies

    Joined:
    Sep 14, 2016
    Posts:
    143
    I'm locking this thread due to its age and since there are two quite separate discussions here:

    If you're experiencing issues where Cloud Builds fail with "Unable to detect NDK version" then please create a new thread in this forum since the issue you are experiencing is definitely not going to be the same thing as this issue from 2015.

    If you're experiencing issues when attempting to build Android IL2CPP locally in the editor then please read or post in the Android Platform forum since you will get a quicker response there from users who are experienced with Android builds, and this brings it directly to the attention of the Android platform developers.
     
Thread Status:
Not open for further replies.