Search Unity

Bug Unity 2019.1.7f1 doesn't see its own Android SDK [solved]

Discussion in 'Linux' started by HZ51, Jun 20, 2019.

  1. HZ51

    HZ51

    Joined:
    Jul 28, 2016
    Posts:
    42
    I try to build APK with Unity 2019.1.7f1. I've installed Unity with Android SDK (througth the install process). Anyway I have the latest Android SDK manually and set up. But I get this message (as in the attached files).

    What can I do?

    Linux Mint 19.1, Unity 2019.1.7f1 (Android SDK included through the installation menu).
     

    Attached Files:

    • 2.png
      2.png
      File size:
      12.2 KB
      Views:
      706
    • 1.png
      1.png
      File size:
      57.1 KB
      Views:
      923
    • 0.png
      0.png
      File size:
      20.8 KB
      Views:
      755
    Last edited: Jun 20, 2019
  2. HZ51

    HZ51

    Joined:
    Jul 28, 2016
    Posts:
    42

    » ls -la /home/denis/Unity/Hub/Editor/2019.1.7f1/Editor/Data/PlaybackEngines/AndroidPlayer/SDK
    drwxrwxr-x 5 denis denis 4096 июн 20 07:10 .
    drwxrwxr-x 10 denis denis 4096 июн 20 07:10 ..
    drwxrwxr-x 3 denis denis 4096 июн 20 07:10 build-tools
    drwxrwxr-x 3 denis denis 4096 июн 20 07:10 platforms
    drwxrwxr-x 5 denis denis 4096 июн 20 07:10 platform-tools


    Looks I have all that Unity needs to see.
     
  3. HZ51

    HZ51

    Joined:
    Jul 28, 2016
    Posts:
    42
    I've updated SDK path with my own SDK installation and it worked. But now I have another problem:

    stdout:
    il2cpp.exe didn't catch exception: System.Exception: Android NDK r13b or newer not detected at '/home/denis/Unity/Hub/Editor/2019.1.7f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK'.
    at Unity.IL2CPP.Building.ToolChains.Android.AndroidNDKUtilities..ctor (NiceIO.NPath ndkRootPath, Unity.IL2CPP.Common.Architecture architecture, System.Boolean useDependenciesToolChain) [0x00088] in <011fe0a303834fe7be028e204fa0c5a4>:0

    But I've changed NDK path to my own but it seems that Unity looking for NDK in your folder again.
    But Unity folder also exists:

     » ls -la /home/denis/Unity/Hub/Editor/2019.1.7f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r16b
    итого 84
    drwxrwxr-x 12 denis denis 4096 июн 20 07:11 .
    drwxrwxr-x 3 denis denis 4096 июн 20 07:10 ..
    drwxrwxr-x 7 denis denis 4096 июн 20 07:11 build
    -rw-rw-r-- 1 denis denis 4210 июн 20 07:11 CHANGELOG.md
    drwxrwxr-x 2 denis denis 4096 июн 20 07:11 meta
    -rw-rw-r-- 1 denis denis 72 июн 20 07:11 ndk-build
    -rw-rw-r-- 1 denis denis 94 июн 20 07:11 ndk-depends
    -rw-rw-r-- 1 denis denis 90 июн 20 07:11 ndk-gdb
    -rw-rw-r-- 1 denis denis 92 июн 20 07:11 ndk-stack
    -rw-rw-r-- 1 denis denis 92 июн 20 07:11 ndk-which
    drwxrwxr-x 14 denis denis 4096 июн 20 07:11 platforms
    drwxrwxr-x 9 denis denis 4096 июн 20 07:10 prebuilt
    drwxrwxr-x 5 denis denis 4096 июн 20 07:11 python-packages
    ...


    Looks like NDK field cannot be changed. But I've successfully changed it in the Unity's preferences. But it doesn't work.
    Also I tried with my own installation of ndk r20.
     
    Last edited: Jun 20, 2019
  4. HZ51

    HZ51

    Joined:
    Jul 28, 2016
    Posts:
    42
    Also I tried to use my own installation of r13b.

    In the console I have this error message:
    Failed running /home/denis/Unity/Hub/Editor/2019.1.7f1/Editor/Data/il2cpp/build/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="Android" --architecture="ARMv7" --configuration="Release" --outputpath="/home/denis/MyUnityProject/StagingArea/assets/bin/Data/Native/armeabi-v7a/libil2cpp.so" --cachedirectory="/home/denis/MyUnityProject/Assets/../Library/il2cpp_android_armeabi-v7a/il2cpp_cache" --additional-include-directories="/home/denis/Unity/Hub/Editor/2019.1.7f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/bdwgc/include" --additional-include-directories="/home/denis/Unity/Hub/Editor/2019.1.7f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/libil2cpp/include" --tool-chain-path="/home/denis/Unity/Hub/Editor/2019.1.7f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK" --profiler-report --map-file-parser="/home/denis/Unity/Hub/Editor/2019.1.7f1/Editor/Data/Tools/MapFileParser/MapFileParser" --directory="/home/denis/MyUnityProject/Temp/StagingArea/assets/bin/Data/Managed" --generatedcppdir="/home/denis/MyUnityProject/Temp/StagingArea/Il2Cpp/il2cppOutput"


    But in the NDK path I've set: /home/denis/Android/NDK/android-ndk-r13b
    And Unity every failed build resets my NDK path to its internal: /home/denis/Unity/Hub/Editor/2019.1.7f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK - that doesn't work for some reason. But the folder extists and there are no problems with the permissions.

    Need Help :)
     
  5. HZ51

    HZ51

    Joined:
    Jul 28, 2016
    Posts:
    42
    Solved: I've downloaded android-ndk-r16b and removed NDK from Unity's path. So I just replaced Unity's NDK with my downloaded ndk-r16b and pressed "Browse" button. Browse button very important thing becase it doesn't work if you just paste the right path without pressing on it :)
     
  6. senkal_

    senkal_

    Joined:
    May 22, 2018
    Posts:
    86
    Hi @HZ51

    SDK

    I had to do similar fix. For me the issue was Unity didn't download all directories.
    The dirs you listed installed by Unity:
    Code (CSharp):
    1. drwxrwxr-x  5 denis denis 4096 июн 20 07:10 .
    2.  
    3. drwxrwxr-x 10 denis denis 4096 июн 20 07:10 ..
    4.  
    5. drwxrwxr-x  3 denis denis 4096 июн 20 07:10 build-tools
    6.  
    7. drwxrwxr-x  3 denis denis 4096 июн 20 07:10 platforms
    8.  
    9. drwxrwxr-x  5 denis denis 4096 июн 20 07:10 platform-tools
    miss "tools" directory.
    I had similar fix to yours, either point to my own SDK directory or copy my SDK to Unity.
    Chose pointing to my own directory.

    NDK
    How did you manage to select your own NDK?
    I did download both 13 and 16, Unity needs 16 officially by default for 2019.1.
    All should be fine but Unity still doesn't detect the NDK.
    I get " exception: System.Exception: Android NDK r13b or newer not detected at"

    Another option is then to choose my own NDK directory, like before Unity 2019.
    Unfortunately Unity doesn't respect it. I can put my own path in preferences but if I run "build" command Unity defaults to default path.
    The same happen if I put my own NDK path and click browse, it resets value to default Unity path.
    Basically I can't select my own NDK path so building Android with IL2CPP doesn't' work for me, have to use mono.

    Couldn't find if similar issue is reported, maybe will create one.

    Unity 2019.1.11f
    Mint 18.2
     
  7. tiagoandr

    tiagoandr

    Joined:
    Jun 30, 2019
    Posts:
    25
    honestly, what's the whole point of giving the option to install the SDK/NDK with Unity if Unity itself does not recognize its own installed files?
     
  8. senkal_

    senkal_

    Joined:
    May 22, 2018
    Posts:
    86
    @tiagoandr
    I am afraid some of the issues are related to Linux.
    I know they were hub upgrades since then, 2.1.0, and Unity 2019.2.1 upgrade has some potentially related fixes.
    Didn't test them yet since I moved to Windows for now, can't waste so much time on technical issues, but will do when get some time.

    If you have the opportunity to test it and you had the issue originally, would be great if you checked it.
     
  9. Muhamad_Faizol

    Muhamad_Faizol

    Joined:
    Jan 21, 2017
    Posts:
    47
    Actually Android SDK packaged together with Unity somehow doesn't include "tools" folder. One can download SDK from google website and copy "tools" folder into Unity/Hub/Editor/<Unity version>/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/ folder.
     
  10. Eyap

    Eyap

    Joined:
    Nov 17, 2017
    Posts:
    40
    Got the same problem with Unity Hub 2.1.0 and Unity 2019.2.2f1 (on Ubuntu 19.04).

    Is there a reason the Tools folder is not included ?
     
  11. aStrangeLoop

    aStrangeLoop

    Joined:
    Feb 17, 2018
    Posts:
    8
    I've got the exact same problem with Unity Hub 2.1.0 and Unity 2019.2.2f1 (on Ubuntu 18.04).

    Also clicking on the browse button after the field where you can enter your own path to an android SDK doesn't let you browse to a location but enters the path of Unity's Android SDK into the field instead.
     
    Eyap likes this.
  12. senkal_

    senkal_

    Joined:
    May 22, 2018
    Posts:
    86