Android CI build: Could not find aapt2-proto.jar

Try moving the google() method to the top of its execution block.

Maybe it's the order of repositories it searches in that causes the issue.

So for example, change this:

repositories {
  maven { url 'https://maven.fabric.io/public' }
  google() // from here
  mavenCentral()
}

To this:

repositories {
  google() // to here
  maven { url 'https://maven.fabric.io/public' }
  mavenCentral()
}

If that doesn't help, instead of calling the google() method, try changing it to this:

maven {
  url 'https://maven.google.com/'
  name 'Google'
}

UPDATE

If all of the above didn't help - make sure your gradle version is at least 3.0.0:

dependencies {
  classpath 'com.android.tools.build:gradle:3.2.1'
}

And the gradle-wrapper version is at least 4.1:

Usually located here: project_name/gradle/wrapper/gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

Source


Upgrading the Gradle wrapper (in gradle-wrapper.properties) to gradle-4.10.2-all.zip fixed the problem to me.