Cordova build changes distributionUrl in gradle-wrapper.properties file

后端 未结 8 1193
小鲜肉
小鲜肉 2020-12-05 06:30

I keep getting the following build exception when I run

 cordova run android --verbose
  • What went wrong: A problem occurred evaluatin
8条回答
  •  情深已故
    2020-12-05 07:17

    As could be guessed, there is a script that is being run behind the scene when you issue the "Cordova build android" command. This script needs to be found in order to see the config specified for Gradle version.

    You must go and check the following js file:

    $PROJECT_ROOT/platforms/android/cordova/lib/builders/GradleBuilder.js

    Then find the line including the following variable in the file:

    GradleBuilder.prototype.prepEnv
    

    And check the distributionUrl variable:

    var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'http\\://services.gradle.org/distributions/gradle-2.2.1-all.zip';
    

    That's what you are looking for and what you need to change to gradle-2.10-all.zip URL;

    Now you can run the build command, and there you go!

    inspired from the following SO; install gradle for using in cordova build android

提交回复
热议问题