Android NDK Folder problem having several Unity versions installed

Hello! We have a Gitlab pipeline that builds some projects that use different versions of Unity. So, in a single machine we have for example Unity 5.6 and Unity 2017.4 (Like using Unity Hub).

To use IL2CPP scripting backend we need to configure the AndroidNDK folder. Unity 5.6 uses NDK version r10 and Unity 2017.4 uses version r13. Because Unity stores their preferences in the same file for all Unity versions (/Users/{user}/Library/Preferences/com.unity3d.UnityEditor5.x.plist for Mac), if we configure the NDK for Unity 5.6 the builds will fail for projects that use Unity 2017.4.

Does anyone know if there’s a Unity command line argument to configure this? I didn’t find anything useful in the documentation.

An ugly solution would be having an Editor script initialized on load that configures the NDK version using EditorPrefs.

Thx for your post. I had the problem “Unable to detect NDK version” with unity 2017.4 and NDK r13b. I had 2 version of unity installed on unity Hub, i just uninstall the old version and now unity 2017.4 and NDK r13b works fine…