Android Studio 3.2 - Could not find com.android.tools.build:aapt2:3.2.0-4818971
Most likely you do not have the Google repository in your project's build.gradle file. Add google()
in BOTH locations as shown below:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Android studio Could not find com.android.tools.build:aapt2:3.2.0-4818971
Add google()
do your build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Could not find com.android.tools.build:aapt2:4.0.0-6051327
add google()
dependency in your build.gradle file.
allprojects {
repositories {
google() // this one is missing in your code
jcenter()
}
}
and use implementation
instead of compile
as it was deprecated.
Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.3.1)
This is due you didn’t put google()
as the first repo. The order of google()
matters. So just add it above jcenter()
will solve your problem.
See https://stackoverflow.com/a/51151050/8034839
Note that this change should be in your TOP level build.gradle
file. E.g.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google() // first one
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google() // first one
jcenter()
}
}
Note:
Since Android Gradle Plugin (AGP) version 3.0.0 (Gradle version 4.1+), Google introduced its own Google's Maven repository google()
, most of the dependencies were moved to there. So, if you are using the AGP 3.0+, you should refer to this NEW repo firstly.
And here is some explanation about different gradle versions: What is real Android Studio Gradle Version?
Build errors after Android Studio 3.2.1 upgrade
For Android Studio 3.2.1 update
Just add google()
in root level build.gradle
buildscript {
repositories {
google() // <--here
jcenter()
}
}
allprojects {
repositories {
google() // <-- here
jcenter()
}
}
and see the magic - error is gone.
Related Topics
How to Define Different Dependencies for Different Product Flavors
Mediacodec and Camera: Colorspaces Don't Match
Android - File Provider - Permission Denial
Gson Noclassdeffounderror After Adt and Sdk Tools Update to V17
How to Change the Spinner Background in Android
Android Studio Isn't Opening on Windows
Disable/Check for Mock Location (Prevent Gps Spoofing)
Programmatically Update Widget from Activity/Service/Receiver
Method Not Found Using Digestutils in Android
How to Make an Application Ignore Screen Orientation Change
Passing String Array Between Android Activities
How to Create a Transparent Demo Screen for an Android App
Change Toolbar Color in Appcompat 21