Et Andrea
Et Andrea

Reputation: 273

Unable to debug cordova app due to adb.exe

I have just created a plain 'helloworld' cordova app on Visual Studio. I can't debug my app on either android emulator or device though it works only in the ripple emulator. Please help.

I keep getting error "Unable to start mypathname/adb.exe"

enter image description here

  1. Tried adb kill-server and adb start-server in cmd (result: server restarted successfully)

  2. Installed necessary mobile driver and upgraded my driver too

  3. Configured to set allow for USB debugging under Developer options

  4. Devices are detected and shown enter image description here

Upvotes: 14

Views: 9217

Answers (7)

Linda Z
Linda Z

Reputation: 312

You cannot use the VS Debugger for apps deployed to emulators or devices running Android versions prior to 4.4 without the use of a 3rd party plugin like jsHybugger. JavaScript console output is, however, captured in the Output window.

While debugging to devices with Android versions prior to 4.4, an error popup may display the error “Unable to start program” citing “adb.exe” as the cause. The app should still load and work on your device, without debugger support.

Upvotes: 1

vontarro
vontarro

Reputation: 359

Running Visual Studio as administrator solved the problem.

Upvotes: 0

Andy
Andy

Reputation: 31

Go to Build/Configuration manager and check if you have choosen Debug configuation instead of Release.

Upvotes: 2

Chilledflame
Chilledflame

Reputation: 166

Assuming adb is in your path (otherwise CD to the correct path), try adb devices from the command line, and see if you have more than one device listed.

If so, check if you have other emulators running - such as blustacks, and close / kill these and try again.

Upvotes: 1

harsa_
harsa_

Reputation: 632

AppGyver's Steroids tooling works on Windows and provides you with enhanced access to the Chrome Inspector for debugging what happens in the WebView, so you don't necessarily need to rely on Visual Studio's debugging tools.

You can run Steroids it in your Cordova project directly without modifying any files.

(Disclaimer: I'm a programmer for AppGyver.)

Upvotes: 0

Roope Hakulinen
Roope Hakulinen

Reputation: 7405

After doing much more research, I discovered this thread on Google and it with the fact that browsers also show error Unexpected token ILLEGAL to signal about invisible characters etc. that are usually there by accident, were enough for me to think that you have UNIX style line changes which Visual Studio can't tolerate.

Fixing this isn't too easy on Windows, but you can download unix2dos here (I know it looks suspicious, but it is recommended by 110k user on ServerFault here) and use it to convert all the files in that project. You can also obtain the basic project from other sources such as Apache Cordova Hello World Application on GitHub.

Upvotes: 0

Roope Hakulinen
Roope Hakulinen

Reputation: 7405

Which Android versions are you using? There seems to be known issue for Visual Studio & Cordova that says

When using the VS Debugger with Android < 4.4 emulators, devices, or Apache Ripple™: While debugging to devices with Android versions <4.4, an error popup shows up “Unable to start program” citing “adb.exe” as the cause. The app should still load and work on your device, without debugger support.

and the status seems to be No fix available.

Upvotes: 8

Related Questions