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.
- 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 - Download this file (cordova-android-3.2.0-221b10b.tar.gz) using a regular browser which has working internet connection.
- Open the file in a File Compression Software (for ex - 7zip).
- This would contain another TAR file (cordova-android-3.2.0-221b10b.tar)
- Drill into the TAR file to find a folder (cordova-android-3.2.0-221b10b)
- 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. - 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...) - 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.
- Re-run
cordova platform add android --verbose
and this time it should saycordova library for "android" already exists. No need to download. Continuing.
- And should continue to create the Android project for your use.
- 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.