Search code examples
androidnode.jscordovavisual-studio-2013apache-cordova

VS2013/Cordova - Cannot debug in device even when build/deploy success due to adb


This problem has been bothering me for days now. Previously, I was able to debug my Cordova App on my Android device (version 5.1.1, Lollipop). Now, I cannot debug my app as a popup displays indicating:

"Unable to start program %APPDATA%\Local\Android\android-sdk\platform-tools\adb.exe"

I have confirmed that this program is located at the correct folder.

What I have tried:

1) According to my research, using an updated software for Android will make this popup "go away". However, I am already using a device on Lollipop version and he problem still exists. In fact, it is the same device that I use previously.

2) I have also read that I should delete a folder then re-build my app. I lost the link to the folder or the reference but I remember it being a componentmodule or componentcache which is being regenerated after a build.

Notes:

0) Even a blank app (new Cordova project) displays this problematic popup.

1) There are no Build and Deploy problems or errors encountered.

2) There is no problem in debugging using Ripple. I encounter this problem when I try to debug on my device or the emulator.

3) Visual Studio seems to be opening the app in an emulator instead of my device. Output log indicates

Starting launch process C:\Program Files (x86)\nodejs\node.exe "C:\Users\[ME]\AppData\Roaming\npm\node_modules\vs-mda\emulator.js" --platform android --path "D:_My Files\Test Dummy Path\POTATOMIDGETS\POTATOMIDGETS\bld\Debug" --deployTarget "device" --language en-US --configuration debug

========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

4) I suspect it might be due to me updating my NPM and Node. I executed "npm cache clean -f" then used Chocolatey "cinst nodejs.install".

5) If not the forementioned update, the very least suspect that I can point to is me trying to use the Whitelist plugin...which I do not believe to be the cause of this.

6) My device is connected as MTP. It is detected when I type "adb devices".

Some specifications:

If this helps, I will list version details.

  • Visual Studio 2013 Update 5
  • Cordova 6.0.0
  • NPM 3.8.1
  • Node 5.8.0

I hope someone can kindly direct me as to how to resolve this. Thank you for the response and have a great day!


Solution

  • A few things that I did to fix this problem:

    1. Cleared the cache once more
    2. Reinstalled Cordova
    3. Used the latest LTS Node v4.4.0 instead of the latest stable Node 5.8.0. (Which I believe is really the main error fix)

    And now I am able to debug on both my emulator and phone. :)

    Perhaps the problem was due to mismatched versions?

    Note: I am still considering explanations. Please feel free to comment or post an answer. Thank you!