To avoid gradle download for each build, you may follow the workaround as follows:
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 from:?var 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) Execute the following command: cordova run android
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…