This is a solution to the above error that I want to document. I found other similar posts, but none described how this error can be associated with Cordova or Ionic.
I
For follow error:
Minimum supported Gradle version is 4.1. Current version is 3.3. If using t he gradle wrapper, try editing the distributionUrl in E:\ionic\MyIonicProject\gr adle\wrapper\gradle-wrapper.properties to gradle-4.1-all.zip for gradle 4.1
This command worked for me:
ionic cordova platform update android
I want to extend @bungler answer.
I got confused with version of gradle & compatible version of android plugin for gradle. Following link has the list of compatibale versions mapping:
Gradle vs Android plugin for gradle - Compatible version list
For current version of gradle 3.3+, compatible version of android plugin is 2.3.3
So final settings will look like following:
For Mac
STEP 1: Add following in env variables:
option a) update env variable:
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="https\://services.gradle.org/distributions/gradle-3.3-all.zip"
or
option b ) you can download the gradle file and place it in <project>/platforms/android/gradle/
and update env variable:
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="../gradle-3.3-all.zip"
STEP 2: Update following in <project>/platforms/android/CordovaLib/build.gradle
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
This worked for me.