Google have new maven repo
https://android-developers.googleblog.com/2017/10/android-studio-30.html > section Google's Maven Repository
https://developer.android.com/studio/preview/features/new-android-plugin-migration.html https://developer.android.com/studio/build/dependencies.html#google-maven
So add the dependency on maven repo:
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google() // new which replace https://maven.google.com
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3' //Minimum supported Gradle version is 4.6.
}
}
For things to compile via command line I needed to include the maven repo in BOTH buildscript
and allprojects
.
root build.gradle
:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
...
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
It's needed in the buildscript
block to find the AGP, and in allprojects
block to find android.arch
and com.android.databinding
packages (and others)
UPDATE:
It looks like the new repo is just called google()
but I still needed to declare it in both places.
To synchronize all of the answers here and elsewhere:
buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' } }
Make your buildscript in build.gradle look like this. It finds all of them between google and jcenter. Only one of them will not find all of the dependencies as of this answer.
mtrakal's solution worked fine.
Added to gradle.build:
buildscript {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
// NOTE: Do not place your application dependencies here;
// they belong in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Then it automatically upgraded to alpha2.
Invalidate the caches and restarted all is fine.
File | Invalidate Caches / Restart
choose 'Invalidate & Restart'
For Iranian people: We need use proxy or VPN to building app.
Reason: The boycott by Google's servers causes that you can't build app or upgrade your requirement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With