1

I have a problem in Visual Studio 2015 Community - Apache Cordova. I try to run a simple application both in Debug mode as in Release mode and is generated the following error:

*2>  ANDROID_HOME=F:\AndroidSDK
2>  JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_55
2>C:\Temp\BlankCordovaApp1\BlankCordovaApp1\platforms\android\cordova\node_modules\q\q.js:126
2>throw e;
2>^
2>Error: Device communication timed out. Try unplugging & replugging the device.
2>at null._onTimeout (C:\Temp\Excluir\BlankCordovaApp1\BlankCordovaApp1\platforms\android\cordova\node_modules\q\q.js:1717:25)
2>at Timer.listOnTimeout (timers.js:110:15)
2>  Command finished with error code 1: cmd /s /c "C:\Temp\BlankCordovaApp1\BlankCordovaApp1\platforms\android\cordova\run.bat --nobuild --target=169.254.138.177:5555 --debug --buildConfig=C:\Temp\BlankCordovaApp1\BlankCordovaApp1\build.json"
2>  ERROR running one or more of the platforms: Error: cmd: Command failed with exit code 1
2>  You may not have the required environment or OS to run this project
2>  
2>C:\Temp\BlankCordovaApp1\BlankCordovaApp1\platforms\android\cordova\node_modules\q\q.js:126
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========*

My AndroidSDK is complete (with all APIs and extras) . The path is correct for my AndroidSDK . Already tried to run on other versions of Android and the error is the same. In Visual studio I have made ​​clear cordova cache and deleted folders and created a new project. Already reinstalled Apache Cordova. The emulators are using Hyper V and operate correctly. My Windows is 10 64 bits.

How to fix this problem ?

  • I think you can read this question, pay attention to the comment for Windows environment at the accepted answer (stackoverflow.com/questions/29721410/…) – BNK Oct 10 '15 at 21:04
  • The real error here is ">Error: Device communication timed out. Try unplugging & replugging the device." The "You may not have the required environment or OS to run this project" is a generic message. Are you trying to run this on the VS Android emulator or an actual Android device? If a device, be sure you have the actual Windows driver for your device installed - The Google works on Nexus devices but often not others (most notable Samsung). You can also try running "adb kill-server" followed by "adb start-server" to try to fix it. – Chuck Lantz Oct 12 '15 at 21:35
8

The real problem: Timeout.

I do not know what causes this problem, but I have a possible solution.

Folder: platforms\android\cordova\node_modules\q

File: q.js

Line: deferred.reject(new Error(message || "Timed out after " + ms + " ms")); }, ms);

Modify: deferred.reject(new Error(message || "Timed out after " + ms + " ms")); }, 40000);

However, in my case I have finished running manually (shortcut key: Ctrl + Break), as the figure: Visual Studio

0

Another way that helped me is to run this commands in terminal:

cordova clean
cordova build
cordova run android

After this no more:

Error: Device communication timed out. Try unplugging & replugging the device

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.