Android Ci Build: Could Not Find Aapt2-Proto.Jar

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?

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

Flutter Error on Android: Could not find aapt2-proto.jar

Missing google() in file: flutter/packages/flutter_tools/gradle/flutter.gradle#L21

Should be resolved after merge https://github.com/flutter/flutter/pull/23397

Phonegap build (Could not find aapt2-proto.jar)

When importing cordova app to android studio it asks for gradle update, CANCEL IT!!!!
Sample Image

Couldn't locate lint-gradle-api-26.1.2.jar for Flutter project

I solved the problem by moving:

maven {
url 'https://dl.google.com/dl/android/maven2'
}

in the top of:

jcenter()

in the file: .flutter/packages/flutter_tools/gradle/flutter.gradle:

    buildscript {
repositories {
maven {
url 'https://dl.google.com/dl/android/maven2'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}

Could not find runtime.jar (android.arch.lifecycle:runtime:1.0.0)

A quick temporary fix is to include the google maven repo in your top level gradle file.

allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.google.com' } // <-- add this!
jcenter()


Related Topics



Leave a reply



Submit