cordova build error Exit code 1

不羁岁月 提交于 2019-12-01 13:29:02

问题


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 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) Exeucte the following command: cordova run android



来源:https://stackoverflow.com/questions/37254222/cordova-build-error-exit-code-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!