Minimum supported Gradle version is 4.1. Current version is 4.1-rc-1

How can I solve this error
Minimum supported Gradle version is 4.1. Current version is 4.1-rc-1

Detailed msg:

  • What went wrong:
    A problem occurred evaluating root project ‘android’.

Failed to apply plugin [id ‘com.android.application’]
Minimum supported Gradle version is 4.1. Current version is 4.1-rc-1. If using the gradle wrapper, try editing the distributionUrl in /xx/gradle-wrapper.properties to gradle-4.1-all.zip

thank you

2 Likes

Edited my GradleBuilder.js in some location like this
$PROJECT_ROOT/platforms/android/cordova/lib/builders/GradleBuilder.js

my original line
var distributionUrl = process.env[‘CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL’] || ‘http\://services.gradle.org/distributions/gradle-2.2.1-all.zip’;
var distributionUrl = ‘https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip’;

changed to gradle-4.2-all.zip and worked !

reference more details -> https://stackoverflow.com/questions/37125496/cordova-build-changes-distributionurl-in-gradle-wrapper-properties-file

7 Likes

Also update in this file
File Path: platforms\android\cordova\lib\builders\StudioBuilder.js

1 Like

it’s better to use environment variable with:

export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=https://services.gradle.org/distributions/gradle-4.2-all.zip

${PROJECT_ROOT}/platforms are generated files

with your method you need to change each time you do a cordova add plaftorm android or simply reload your project from your repository.

with environment variable you only need to update the variable when you update your gradle (for example when Android Studio ask you to update it). And can be use for all the project.

1 Like

in my ionic v4, your solution did help but in my case, file name was ProjectBuilder.js