Build errors after Android Studio 3.2.1 upgrade

The project gradle version is pretty old:

classpath 'com.android.tools.build:gradle:2.2.3'

And you are using Android Studio v3.2.1 so, update the gradle:

classpath 'com.android.tools.build:gradle:3.2.0' // or 3.2.1 maybe

Also, as you can see, it was looking for some packages in :

file:/C:/Users/sandeepk2/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom

Which means you probably forgot to add google() as the top level repository. Just add google()

to your repositories in your root build.gradle.


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.


To get this solved

Firstly download the missing Jar file from the link below. I see you are missing version 3.2.1-4818971

https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-windows.jar

Switch your folder structure from Android to Project.

FolderStructure

Now navigate to the libs folder inside the app - build folder. (If the libs folder does not exist, you can create it by right clicking on the app folder - select New - select Directory.)

LibsFolder

Paste the downloaded.jar file inside libs folder. Right click on the jar file and at the bottom click on Add as library. This will take care of adding implementation files('libs/library_name.jar') in build.gradle [You don't have to manually enter this in your build file].

AddAsLibrary

Everything should be okay once you sync after doing the above. Here is the source link to this solution: https://developer.android.com/studio/command-line/aapt2#download_aapt2

Let me know if you run into any other issues whilst doing the above.