Question

I am getting ETIMEDOUT error while adding a platform android to an existing cordova project.

I have NPM HTTP and HTTPS proxy configured correct (I installed cordova that way).

But when doing cordova platform add android I am getting ETIMEDOUT network timeout error.

Can't proceed and I tried all possible network configurations possible via command-line/IE Options. As per the documentation Cordova binary should use the same network http/https proxy configuration of NPM (Node.js)

Was it helpful?

Solution

After some research (Mostly head banging), I found a work-around (but still couldn't fix the network timeout issue). I had to study Cordova implementation for "add platform" to understand this better.

  1. Execute cordova platform add android --verbose and this will give you the output URL which it tries to connect but fails - For ex - https://git-wip-us.apache.org/repos/asf?p=cordova-android.git;a=snapshot;h=3.2.0;sf=tgz
  2. Download this file (cordova-android-3.2.0-221b10b.tar.gz) using a regular browser which has working internet connection.
  3. Open the file in a File Compression Software (for ex - 7zip).
  4. This would contain another TAR file (cordova-android-3.2.0-221b10b.tar)
  5. Drill into the TAR file to find a folder (cordova-android-3.2.0-221b10b)
  6. The command cordova platform add android first verifies if these files are present at %home%\.cordova\lib\android\cordova\3.2.0 folder before it tries to download them.
  7. So copy the contents of the folder from Step#5 into the folder %home%\.cordova\lib\android\cordova\3.2.0 (bin, framework, test, .gitignore, .reviewboardrc, LICENSE...)
  8. This process definitely works for Windows 64 bit platform (for 32 bit copy into %USERPROFILE%.cordova\lib\android\cordova\3.2.0). For Linux based machines this should be in the home folder for the current user too. So try that.
  9. Re-run cordova platform add android --verbose and this time it should say

    cordova library for "android" already exists. No need to download. Continuing.

  10. And should continue to create the Android project for your use.
  11. If you face any other errors, ensure that you have JAVA_HOME set to a JDK folder and JDK Folder\bin is available in the PATH environment variable.

OTHER TIPS

I had the same problem, and I resolve it by upgrading from Apache Ant 1.7.0 to Apache Ant 1.8.4

Using Apache Ant 1.7.0, the download will always fail with an "ETIMEDOUT error".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top