android build failed and the error is
Minimum supported Gradle version is 5.1.1. Current version is 4.10.2


My build.gradle file is
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven { url "https://jitpack.io" }
}
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 28
}
}
}
}
ext {
buildToolsVersion = "28.0.2"
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 26
supportLibVersion = "28.0.0"
}
@kidmysoul Did you try bumping the version number like the error message says? The file is usually at gradle/wrapper/gradle-wrapper.properties.
@tido64
yes I tried to update it to version 5 but build failed because the latest react-native dost support version 5 currently.
and maybe because I use android studio 3.4?
Which version of React Native are you using? We've been using Gradle 5 without issues. What kind of errors are you getting?
@kidmysoul if you look at build tools changelog You'll see that your version (3.4.1) requires gradle 5.1.1+.
Try downgrading build tools to 3.3.2:
In your root dir build.gradle, change line:
dependencies {
- classpath 'com.android.tools.build:gradle:3.4.1'
+ classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
@Krizzu
yes you are right. the build successed when change back to 3.3.2.
I'm facing a similar issue:
This is my project build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
kotlin_version = "1.2.61"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
}
}
}
}
subprojects {project ->
if (project.name.contains('react-native-image-picker')) {
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}
subprojects {project ->
if (project.name.contains('react-native-vector-icons')) {
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}
subprojects {project ->
if (project.name.contains('react-native-reanimated')) {
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}
subprojects {project ->
if (project.name.contains('react-native-screens')) {
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}
subprojects {project ->
if (project.name.contains('rn-fetch-blob')) {
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}
And when I try to build the app I get:
```* What went wrong:
A problem occurred evaluating project ':@react-native-community_async-storage'.
Failed to apply plugin [id 'com.android.library']
Minimum supported Gradle version is 4.10.1. Current version is 4.4. If using the gradle wrapper, try editing the distributionUrl in /Users/osp/dev/pave/mobileapp/android/gradle/wrapper/gradle-wrapper.properties to gradle-4.10.1-all.zip```
@ospfranco
Minimum supported Gradle version is 4.10.1.
Current version is 4.4.
If using the gradle wrapper, try editing the distributionUrl in /Users/osp/dev/pave/mobileapp/android/gradle/wrapper/gradle-wrapper.properties to gradle-4.10.1-all.zip
well downgrading the gradle version does make this package work, but broke other dependecies, anyways, I had to fix those, in any case, thanks for help!
react-native-firebase needs version 'com.android.tools.build:gradle 3.4.1
What should we do now? 3.4.1 gives error with asyncstorage.
@rendomnet
Please see my comment in issue you created:
https://github.com/react-native-community/async-storage/issues/151
sorted out
android.overridePathCheck=true
to
gradle.properties
For the Gradle Version 5.6.2 / Android Plugin 3.5.0.
Based on: _https://developer.android.com/studio/releases/gradle-plugin_
After a few hours. I did this and it worked for me.
In _platform/android/app/build.gradle_ changed:
classpath 'com.android.tools.build:gradle:3.5.0'
task wrapper(type: Wrapper) {
gradleVersion = '5.6.2'
}
Then:
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="https\\://services.gradle.org/distributions/gradle-5.6.2-all.zip"
_https://stackoverflow.com/a/53291563/5922720_
Then run:
ionic cordova run android
sometimes you also need to edit gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
You probably using global Gradle try to build using ./gradlew
gradle wrapper --gradle-version=5.1.1
Most helpful comment
@kidmysoul if you look at build tools changelog You'll see that your version (3.4.1) requires gradle 5.1.1+.
Try downgrading build tools to 3.3.2:
In your root dir
build.gradle, change line: