in android ~ read.

Gradle fails with “Could not find aapt2-proto.jar”

Almost every other time I go through an Android Studio upgrade, my projects no longer compile and I spend an hour or so trying to figure out what was wrong or what I need to change.

Due to this reason very often I will postpone upgrading as much as possible, especially if I have an upcoming application update that I am trying to release on time.

The latest Android Studio upgrade was not an exception. After the upgrade to v. 3.2.1, Gradle failed to compile my project with the following error:


Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.3.1)

It turns out that it the issue was with the order of the repositories in the build.gradle file. For some reason the google repo had to be moved at the top (above the maven repo), otherwise the appt2-proto library could not be found.

Here is how it looks (fixed):


buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'de.felixschulze.gradle:gradle-hockeyapp-plugin:3.6'
    }
}