Problem while running the app with genymotion
Hello,
I have successfully build the app, but couldn't run the app in genymotion emulator. I have created an AVD and start the AVD, then from command prompt I have used
tns run android --emulator command. But it's not working I am providing the log D:\abhisek\groceries\sample-Groceries>tns run android --emulator --log trace execFile: C:\Users\Personal\AppData\Local\Android\android-sdk\platform-tools\adb "help" spawn: C:\Users\Personal\AppData\Local\Android\android-sdk\tools\android.bat "-- help"
Usage:
android [global options] action [action options]
Global options:
-s --silent : Silent mode, shows errors only. -v --verbose : Verbose mode, shows errors, warnings and all messages. --clear-cache: Clear the SDK Manager repository manifest cache. -h --help : Help on a specific command.
Valid
actions
are
composed
of a verb
and an
optional
direct
object:
- sdk : Displays the SDK Manager window.
- avd : Displays the AVD Manager window.
- list : Lists existing targets or virtual devices.
- list avd : Lists existing Android Virtual Devices.
- list target : Lists existing targets.
- list device : Lists existing devices.
- list sdk : Lists remote SDK repository.
- create avd : Creates a new Android Virtual Device.
- move avd : Moves or renames an Android Virtual Device.
- delete avd : Deletes an Android Virtual Device.
- update avd : Updates an Android Virtual Device to match the folders of a new SDK.
- create project : Creates a new Android project.
- update project : Updates an Android project (must already have an AndroidManifest.xml).
- create test-project : Creates a new Android project for a test package.
- update test-project : Updates the Android project for a test package (must already have an AndroidManifest.xml).
- create lib-project : Creates a new Android library project.
- update lib-project : Updates an Android library project (must already have an AndroidManifest.xml).
- create uitest-project: Creates a new UI test project.
- update adb : Updates adb to support the USB devices declared in the SDK add-ons.
- update sdk : Updates the SDK by suggesting new platforms to install if available.
Exec npm -v stdout: 2.14.12
stderr: spawn: java "-version" Exec node-gyp -v stdout: stderr: 'node-gyp' is not recognized as an internal or external command, operable program or batch file.
Exec "C:\Users\Personal\AppData\Local\Android\android-sdk\platform-tools\adb" ve rsion stdout: Android Debug Bridge version 1.0.32 Revision eac51f2bb6a8-android
stderr: spawn: C:\Users\Personal\AppData\Local\Android\android-sdk\tools\android.bat "-h " Exec mono --version stdout: stderr: 'mono' is not recognized as an internal or external command, operable program or batch file.
Exec git --version stdout: git version 2.7.0.windows.2
stderr: Exec gradle -v stdout: stderr: 'gradle' is not recognized as an internal or external command, operable program or batch file.
Exec "C:\Program Files\Java\jdk1.8.0_72\bin\javac" -version stdout: stderr: javac 1.8.0_72
System information:
{ procInfo: 'nativescript/1.5.1',
platform: 'win32',
os: 'Windows 7 Ultimate 6.1.7601',
shell: 'C:\Windows\system32\cmd.exe',
dotNetVer: '4.0.30319',
procArch: 'x64',
nodeVer: 'v4.2.6',
npmVer: '2.14.12',
javaVer: '1.8.0',
nodeGypVer: null,
xcodeVer: null,
itunesInstalled: false,
cocoapodVer: null,
adbVer: 'Android Debug Bridge version 1.0.32',
androidInstalled: true,
monoVer: null,
gitVer: '2.7.0.windows.2',
gradleVer: null,
javacVersion: '1.8.0_72' }
Starting watch on killswitch C:\Users\Personal\AppData\Local\Temp\Personal\KillS
witches\cli
Initializing analytics statuses.
Analytics statuses:
{ TrackFeatureUsage: 1, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'run'.
execFile: C:\Users\Personal\AppData\Local\Android\android-sdk\platform-tools\adb
"help"
spawn: C:\Users\Personal\AppData\Local\Android\android-sdk\platform-tools\adb "s
tart-server"
Looking for project in 'D:\abhisek\groceries\sample-Groceries'
Project directory is 'D:\abhisek\groceries\sample-Groceries'.
Analytics statuses:
{ TrackFeatureUsage: 1, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'run|android'.
spawn: C:\Users\Personal\AppData\Local\Android\android-sdk\tools\emulator "-help
"
Error: Could not find an emulator image to run your project.
at Object.
run android
┌────────────────┬──────────────────────────────────────────────────────────┐
│ Usage │ Synopsis │
│ Run on all │ $ tns run android [--key-store-path
Runs your project on a connected Android device or in a native Android emulator, if configured. This is shorthand for prepare, build and deploy. While your app is running, prints the output from the application in the console.
Options
* --device - Specifies a connected device on which to run the app.
* --emulator - If set, runs the app in a native emulator for the target plat
form, if configured. When set, you can also set any other valid combination of e mulator options as listed by $ tns help emulate android. * --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options. * --key-store-path - Specifies the file path to the keystore file (P12) whic h you want to use to code sign your APK. You can use the --key-store-* options a long with --release to produce a signed release build. You need to specify all - -key-store-* options. * --key-store-password - Provides the password for the keystore file specifi ed with --key-store-path. You can use the --key-store-* options along with --rel ease to produce a signed release build. You need to specify all --key-store-* op tions. * --key-store-alias - Provides the alias for the keystore file specified wit h --key-store-path. You can use the --key-store-* options along with --release t o produce a signed release build. You need to specify all --key-store-* options.
* --key-store-alias-password - Provides the password for the alias specified
with --key-store-alias-password. You can use the --key-store-* options along wi th --release to produce a signed release build. You need to specify all --key-st ore-* options. * --justlaunch - If set, does not print the application output in the consol e.
Attributes
* <Device ID> is the index or name of the target device as listed by $ tns d
evice android
*
So, Please help
It shows that my AVD is running
Hello @abhisekgithub,
tns run android --emulator specifically targets the Android SDK emulator.
You have two options to use Genymotion:
- Start the Genymotion virtual device and never close it. Then remove the --emulator parameter, like
tns run android - use the
--genyparameter, like:tns run android --emulator --geny <The name of your Genymotion virtual device>. You can also use the shorter emulate command, liketns emulate android --geny <Geny device>
For more details, you can refer to our online help at any time using tns help run android.
Hope this helps!
@teobugslayer I followed the instructions you mentioned above. I started my Genymotion virtual device and then from command prompt, when I run: tns run android
tns run android
Error: Command failed: C:\Users\TestUser\AppData\Local\Android\android-sdk\platform-tools\adb devices error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048) could not read ok from ADB Server
-
failed to start daemon * error: cannot connect to daemon : Command failed: C:\Users\TestUser\AppData\Local\Android\android-sdk\platform-tools\adb devices at FiberFuture.wait (C:\Users\TestUser\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:566:15) at C:\Users\TestUser\AppData\Roaming\npm\node_modules\nativescript\lib\common\mobile\mobile-core\android-device-discovery.js:65:49 at C:\Users\TestUser\AppData\Roaming\npm\node_modules\nativescript\lib\common\fiber-bootstrap.js:10:13
error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048) could not read ok from ADB Server
-
failed to start daemon * error: cannot connect to daemon
at ChildProcess.exithandler (child_process.js:206:12) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at maybeClose (internal/child_process.js:877:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
@naveedahmed1, you need to use the custom sdk the nativescript is using.
In Genymotion go to Settings->ADB->Use custom Android SDK tools and then browse for the folder where the sdk is saved. i.e. 'C:/Users/user_name/AppData/Local/Android/android-sdk'