nativescript-cli icon indicating copy to clipboard operation
nativescript-cli copied to clipboard

Problem while running the app with genymotion

Open abhisekgithub opened this issue 10 years ago • 3 comments

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. (C:\Users\Personal\AppData\Roaming\npm\node_modules\na tivescript\lib\common\errors.js:7:23) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object. (C:\Users\Personal\AppData\Roaming\npm\node_modules\na tivescript\lib\nativescript-cli.js:9:16) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) Analytics statuses: { TrackFeatureUsage: 1, TrackExceptions: 0 } Trying to track feature 'CLI' with value 'help'. List of registered commands: /?, autocomplete, autocomplete|disable, autocomplet e|enable, autocomplete|status, build, build|android, build|ios, create, debug, d ebug|android, debug|ios, deploy, dev-post-install, dev-preuninstall, dev-test, d ev-test|android, dev-test|ios, device, device|android, device|get-file, device|i os, device|list-applications, device|list-files, device|log, device|put-file, de vice|run, device|stop, device|uninstall, doctor, emulate, emulate|android, emula te|ios, error-reporting, help, init, install, library, library|add, livesync, pl atform, platform|add, platform|remove, platform|update, plugin, plugin|add, plug in|remove, prepare, run, run|android, run|ios, test, test|android, test|init, te st|ios, usage-reporting Reading help for command 'run|android'. FileName is 'run-android.md'.

run android

┌────────────────┬──────────────────────────────────────────────────────────┐ │ Usage │ Synopsis │ │ Run on all │ $ tns run android [--key-store-path --key │ │ connected │ -store-password --key-store-alias - │ │ devices and │ -key-store-alias-password ] [--release] [- │ │ running │ -justlaunch] │ │ emulators │ │ │ Run on a │ $ tns run android --device [--key-store-path │ │ selected │ --key-store-password --key-store │ │ connected │ -alias --key-store-alias-password ] [- │ │ device or │ -release] [--justlaunch] │ │ running │ │ │ emulator │ │ │ Start an │ $ tns run android --emulator [] [--key │ │ emulator and │ -store-path --key-store-password │ │ run the app │ --key-store-alias --key-store-alias-password │ │ inside it │ ] [--release] [--justlaunch] │ └────────────────┴──────────────────────────────────────────────────────────┘

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 * is any valid combination of options as listed by $ tns help emulate android

So, Please help

temp It shows that my AVD is running

abhisekgithub avatar Feb 09 '16 11:02 abhisekgithub

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 --geny parameter, like: tns run android --emulator --geny <The name of your Genymotion virtual device>. You can also use the shorter emulate command, like tns 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 avatar Feb 09 '16 13:02 teobugslayer

@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 avatar Nov 04 '16 22:11 naveedahmed1

@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'

xartviel avatar Nov 15 '16 08:11 xartviel