Search Unity

Android NDK Not installing correctly, can abort the whole installation

Discussion in 'Unity Hub' started by JoNax97, Feb 19, 2020.

  1. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    Today I started a project for unity, so I went an added android module + sdk/ndk/jdk for unity 2019.3.1 (previously installed). It appeared to install correctly, but when I reopened my projecy, nothing installed (switching build to android showed a not installed message + a link to install android module manually). Neither KDK, SDK, JDK were in the folder they were supposed to be.

    At this point the hub thinks they're installed so I won't let me try again. I tried removing the installation of 19.3.1 and adding again, but now Hub treats it as an externally-installed editor and won't let me add modules.

    I decided to uninstall (remove from hub + delete folder) 19.3.1 and try again. Download progressed up to like 70-80%. I left it in the background. When I come back to see if it had finished, the install is nowhere to be seen. It vanished.

    Just as I looked perplexed and tried again, 2019.3.2 came out and so it replaced 19.3.1 in the hub. So I decided to install that instead. Same thing happened: after 1 hour of downloading, it just disappeared. It's not in the hub UI, it's not in the Hub/Editor folder.
     
    Last edited: Feb 20, 2020
  2. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    Ok, after calming down I decided to investigate a bit. The error is most probably related to the installing of adroid tools. Both times the installation failed it had those checked.

    This line is probably relevant:

    {"moduleName":"UnityInstallStepsWindows","level":"warn","message":"[ { Error: Command failed: \"C:\\Users\\USER\\AppData\\Local\\Temp\\unityhub-ba8430b0-533c-11ea-a81a-619f10710112\\UnitySetup-Android-Support-for-Editor-2019.3.1f1.exe\" /S /D=C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.1f1\n \n at ChildProcess.exithandler (child_process.js:282:12)\n at emitTwo (events.js:125:13)\n at ChildProcess.emit (events.js:213:7)\n at maybeClose (internal/child_process.js:921:16)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)\n killed: false,\n code: 2,\n signal: null,\n cmd: '\"C:\\\\Users\\\\USER\\\\AppData\\\\Local\\\\Temp\\\\unityhub-ba8430b0-533c-11ea-a81a-619f10710112\\\\UnitySetup-Android-Support-for-Editor-2019.3.1f1.exe\" /S /D=C:\\\\Program Files\\\\Unity\\\\Hub\\\\Editor\\\\2019.3.1f1' } ]","timestamp":"2020-02-19T17:39:20.499Z"}

    Here is the complete log: https://pastebin.com/h0ar8Q4H

    I'm installing again without android support. I think it will succeed, will report once something else happens.
    Edit: Effectively, without the android stuff the install completes successfully.
     
    Last edited: Feb 21, 2020
  3. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    Ok so I'll leave this here in case anyone else is having the same issue:

    The problem comes when the hub tries to decompress the NDK zip. It's corrupted or something.
    The workaround is to install the editor first, then install android support + OpenJDK, and then install the SDK. If it fails, go to the following directory:

    <USER FOLDER>\AppData\Local\Temp\unityhub-xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx


    Where the x are a series of hex numbers. Inside you will find a zipped folder called
    android-ndk-rXX-windows-x86_64
    . Try to open it (in my case windows explorer couldn't but 7zip could) and copy the contents of the
    android-ndk-rXX
    folder into

    <Unity installation folder>\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\


    Open unity and it should recognize it without the need to specify an external path.

    Hope this helps someone.
     
  4. LogicFlow

    LogicFlow

    Joined:
    Aug 18, 2018
    Posts:
    33
    Thanks. Failure to extract / install can be caused by a lack of disk space, so before going the manual route, you may want to confirm. NDK needs around 3-3.5GB extracted, 4 should be enough to avoid any problems. Just hit the refresh button on Unity Hub's installer when you've made enough space.
     
  5. noahabannister

    noahabannister

    Joined:
    Oct 12, 2017
    Posts:
    2
    I just tried the manual method, as I have been having NDK install issues. New rig, plenty of space, default install location: C:\Program Files\Unity\Hub\Editor\.

    The manual copy failed to add some files, giving a "Path too long" error:

    try_lock_until.pass.cpp
    try_lock_until_deadlock_bug.pass.cpp
    try_lock_shared_for.pass.cpp
    try_lock_shared_until.pass.cpp
    lock_shared.pass.cpp
    try_lock_shared.pass.cpp
    select_on_container_copy_construction.pass.cpp
    convertible_element_type.non-explicit.ctor.pass.cpp
    convertible_propagate_const.explicit.move_ctor.pass.cpp
    move_assign_convertible_propagate_const.pass.cpp
    assign_convertible_propagate_const.pass.cpp
    operator_element_type_ptr.pass.cpp


    And the list goes on. I can't copy-paste them from the error though, so I'm done typing them...

    Anyway, if I am hitting the windows path limit trying to do this manually, the automated install may be failing for the same reason. Hope this helps someone somewhere. I am going to have to use a custom install location closer to the drive root.

    EDIT: I have resolved my issues. I went ahead and moved the entire install folder closer to root, because I was having problems with more than just the NDK. The NDK still failed to install despite yielding a green checkmark during the install through Hub (so there is still another problem there). I did the manual copy to the now shortened install path and it worked.
     
    Last edited: Jan 30, 2023