I\'m trying to update gradle from 1.3.1 to 3.5, as some of my dependencies requires version 3.3 or above.
I\'ve seen similar questions, but none of them help.
<I had google()
repo both in buildscript
and allprojects
repositories, but still it shows me Could not find gradle-3.5.3
error
Finally I added maven { url "https://maven.google.com" }
, and it fixed the errors!
project's level build.gradle:
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
maven { url "https://maven.google.com" } // <= this line
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" } // <= this line
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
There is a difference between the Android Plugin for Gradle version and the Gradle version being used. The plugin version typically matches the version number of Android Studio you are using. See the documentation for more information. So if using the latest stable Android Studio it should currently be com.android.tools.build:gradle:2.3.1
.
These values can also be reviewed and set from the Project Structure window in Android Studio.
buildscript {
repositories {
jcenter()
google() //HAVE YOU MISS IT?
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
allprojects {
repositories {
jcenter()
google() //HAVE YOU MISS IT?
}
}
You may need to save your build.gradle (for whatever reason, Android Studio doesn't always save your latest changes, as I found even with Android Studio 3.5.3, the gradle sync kept failing even after I had changed the classpath line, and it only picked up the new value after saving the build.gradle file)
Try this
** If you are using android studio 3.5 and your build.gradle(Project
level) is=> classpath 'com.android.tools.build:gradle:3.5.1' or =>
classpath 'com.android.tools.build:gradle:3.5.1'.
than replace with ***
classpath 'com.android.tools.build:gradle:3.3.2' to
classpath 'com.android.tools.build:gradle:3.5.0'
OR
classpath 'com.android.tools.build:gradle:3.5.1'
I got an error after changing version code from 2 to 2.1. When I opened the build with ctrl+shift+alt+s, I realized adding .1 (decimals) resulted in a $ symbol being added to the right and so build failed. I opted to use numbers without decimal positions and it worked. For example, I used 3 for buildversion because I wanted to upgrade the app in playstore.