Visual Studio Cordova - You may not have the requi

2020-06-29 03:27发布

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 ?

2条回答
来,给爷笑一个
2楼-- · 2020-06-29 04:16

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

查看更多
Summer. ? 凉城
3楼-- · 2020-06-29 04:29

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
查看更多
登录 后发表回答