Minimum supported Gradle version is 4.1, why?

When I run the ‘ionic build android’ command on my MacBook
I get the following error:

Minimum supported Gradle version is 4.1. Current version is 2.14.1

Why do I get this error?

My project is an ionic1 project. And this project was working normally on Windows.

ionic info
(in windows)

cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
OS: Windows 10
Node Version: v6.10.2

npm 3.10.10


ionic info

Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: 1.9.2
ios-sim version: 6.0.0
OS: macOS
Node Version: v6.10.0
Xcode version: Xcode 10.1 Build version 10B61

npm 3.10.10

This is the difference between Windows and MacBook.

I built the same Android app normally on Windows.

The problem is that when I use ionic build android on Windows, I use Gradle version 2.14.1 version wrapper

On a Mac, when you have an ionic build andriod
I use Gradle 4.6 in the gradle-related file.

Why would I use gradle 4.6? Why is gradle version different from ionic, which is used by default in both environments?

Another article tells me to upgrade to gradle 4.

However, upgrading to gradle 4 causes an error in the ionic1 project.

I will manage this build with CI, so I can not manually change each configuration file every time.

he problem is that if you change the gradle version in the

platforms/android/gradle/wrapper/gradle-wrapper.properties

file or

platforms/android/build.gradle

file to the following, Why is this? In the window environment, gradle version was specified as 2.2.1 or 2.14.1 without error.


dependencies {
classpath ‘com.android.tools.build:gradle:2.2.1’ << here
}

Both platforms are Android Studio version 3.2.1

What I need to change is when I type the ionic build android or ionic prepare android commands, build.gradle and gradle-wrapper.properties files will have the gradle version registered as 2.x version,

And

Can I have the minimum gradle version set to less than 4?

I need help. Thank you.

2 Likes