Search code examples
macosandroid-studioreact-nativeadbdetox

Detox - test | Android | ChildProcessError: Command failed


detox test -c ios.debug is running tests fine.

detox build -c android.debug builds fine too each time.

But detox test -c android.debug is giving this issue.

It seems to be related to the Android SDK path.

Any ideas?


Solution

  • In the end, it turned out to be Detox looking in the system path that had incomplete Android Studio files/folders, rather than the local user path that had them all.

    You will notice you have a symbolic link called android-sdk in:

    Macintosh HD⁩ ▸ ⁨usr⁩ ▸ ⁨local⁩ ▸ ⁨share⁩

    That points to something like:

    ‎⁨Macintosh HD⁩ ▸ ⁨usr⁩ ▸ ⁨local⁩ ▸ ⁨Caskroom⁩ ▸ ⁨android-sdk⁩ ▸ 4333796

    Simply backup this original symbolic link, then create a new one with the same name in the same location, that instead points to:

    ‎⁨Macintosh HD⁩ ▸ ⁨Users⁩ ▸ ⁨{user}⁩ ▸ ⁨Library⁩ ▸ ⁨Android⁩ ▸ sdk

    And voila, it should now be able to find platform-tools and run your tests.