I had Android development working (by going through the standard NativeScript install instructions in the Getting Started guide), but discovered I needed Google Play Services. In my attempts to get that working I messed up my environment somehow. (My playing around included installing Android Studio, but it didn’t work out so I uninstalled it.) Now
tns run android won’t launch the emulator (I get “Emulator start failed with: Cannot run your app in the native emulator.”)
I finally discovered that if I run
emulator @pixel then the emulator launches and
tns run android will find it, install my app, and run it. So I can develop, but it’s awkward.
My debugging turned up the following:
tns doctor reports no problems
echo $ANDROID_HOME gives
tns device android --available-devices gives
Available emulators ┌─────────────┬──────────┬────────────┬───────────────────┐ │ Device Name │ Platform │ Version │ Device Identifier │ │ │ Android │ android-25 │ pixel │ └─────────────┴──────────┴────────────┴───────────────────┘
tns run android --log trace produces this interesting line:
Starting Android emulator with image pixel spawn: /usr/local/share/android-sdk/tools/emulator "-avd" "pixel"
but it then hangs.
So I tried running that command by hand and got:
Could not launch '/usr/local/share/android-sdk/emulator/qemu/darwin-x86_64/qemu-system-i386': No such file or directory
ls /usr/local/share/android-sdk/ shows that there is no
emulator directory. Further,
which emulator gives
/usr/local/bin/emulator instead of the expected
/usr/local/share/android-sdk/emulator (at least, I think that’s what it should be???).
Somehow, it looks like I need to install emulators in
/usr/local/share/android-sdk but I don’t know how to do that, or if that will even fix the problem.
Any guesses anyone?