Android emulator error


#1

Hello guys, I have the latest version android studio & SDK for Android 7.0 installed.
I ran it on Android Studio and it was working totally fine.
However, when I try to use tns run android on CMD, it gives me this error:

Cannot find connected devices.
Emulator start failed with: Cannot run your app in the native emulator. Increase the timeout of the operation with the --timeout option or try to restart your adb server with 'adb kill-server' command. Alternatively, run the Android Virtual Device manager and increase the allocated RAM for the virtual device.
To list currently connected devices and verify that the specified identifier exists, run 'tns device'.
To list available emulator images, run 'tns device <Platform> --available-devices'.

How do you guys work around this? and is there any way to view existing NativeScript project on a web browser like we can do on Ionic?
It’s based on Angular so I wonder why not. If I can preview everything on a web browser instead of a slow android emulator, it will make the whole job a lot faster.

Thanks,


#2

NativeScript is not Cordova / Hybrid, it doesn’t use any WebView to render your app like Cordova does. All components are native ones not HTML. NativeScript allows web developers to take advantage of frameworks like Angular / Vue to build native mobile apps. So definitely you can’t view existing project in web browser.

Personally I never used Android Emulators but just Genymotion. So I suspect you have to launch the emulator first and then run the tns commands. As you see in your logs, you can always check for available devices using the command tns device <Platform> --available-devices


#3

How do you use Genymotion with NativeScript?
Would you give me an instruction for that?
I’ve been using emulator on android studio and it’s very slow… it takes 7+ minutes to render a blank project.


#4

I don’t think you need any special setup (at least with Mac), just install genymotion and launch the emulators. NativeScript CLI should automatically detect them, you are free to pass device identifier or index in your tns run / debug commands.