问题
I have created referred - https://cordova.apache.org/docs/en/latest/guide/cli/index.html#installing-the-cordova-cli
for creating first cordova android app. I was able t create project and add android platform, but could not build cordova, following error appeared. Following is the commands executed from command prompt
回答1:
It looks more of a network issue. The gradle download will fail if you are using restricted proxy network. In case of network restrictions, you can work around this issue by following the steps below:
1) Download the required gradle version zip file from gradle distribution link and save it in local folder.
2) Navigate to PROJECT_ROOT_FOLDER/platforms/android/cordova/lib/builders folder and edit GradleBuilder.js file
3) Change the line fromvar distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'http\\://services.gradle.org/distributions/gradle-2.2.1-all.zip';
to'var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'file:///local/path/to/folder/where/gradle/zip/is/saved/gradle-2.2.1-all.zip';
and save the file
4 Try rebuilding android build.
You can also try the following as quick fix,
1) In command prompt execute the following command:
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=file:///local/path/to/folder/where/gradle/zip/is/saved/gradle-2.2.1-all.zip
2) Exeucte the following command:cordova run android
来源:https://stackoverflow.com/questions/37254222/cordova-build-error-exit-code-1