cordova-android: gradle wrapper broken

Bug Report

gradle wrapper broken

Problem

cordova platform add android cordova platform add browser gradle wrapper --gradle-version 5.1.1 cordova prepare

What is expected to happen?

app\build.gradle : line:42

task wrapper(type: Wrapper) {
    gradleVersion = '5.1.1'
}

What does actually happen?

app\build.gradle : line:42

task wrapper(type: Wrapper) {
    gradleVersion = '4.10.3'
}

Information

9.0.0 (cordova-lib@9.0.1)

Command or Code

Environment, Platform, Device

Version information

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (6 by maintainers)

Most upvoted comments

I actually realized you just need to change this line in /android/cordova/lib/builders/ProjectBuilder.js:

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

this is simply reproducible by creating your cordova project and then attempting to operate a different gradle version namely the one android studio likes.

I’m running Android Studio 3.4.2, which is their current latest release with Gradle 4.x without problems, so I don’t think it’s quite that simple.

I think this might also be related to https://github.com/apache/cordova-android/issues/718