31

After updrading to gradle 4.4:

gradle-wrapper.properties

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

Android project compilation fails with the following error:

Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.1.2).
Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/build/manifest-merger/26.1.2/manifest-merger-26.1.2.jar
Jérémy Reynaud
  • 3,020
  • 1
  • 24
  • 36

4 Answers4

84

The solution is quite simple, you have to invert jcenter() and google() repositories in your root build.gradle file (in mine jcenter() was first):

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}
Jérémy Reynaud
  • 3,020
  • 1
  • 24
  • 36
  • 2
    Emphasis here on changing this in *both* places (in the `buildscript` section as well as `allprojects`) in the *root* build.gradle file, as that initially tripped me up. Most Android projects will have at least two build.gradle files, one in the root folder, and one in the `app` folder. – Michael Berry Jan 19 '19 at 13:48
  • 3
    LOL, another page to the Android Studio jokebook – Josh Apr 03 '19 at 13:08
10

I solved this by upgrading gradle wrapper version to gradle-4.10.1-all.zip

gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Shayan_Aryan
  • 2,002
  • 1
  • 29
  • 31
4

Cleaning up Gradle cache (~/.gradle/caches) worked for me.

esmiralha
  • 10,587
  • 1
  • 16
  • 20
0
  1. Remove .gradle folder in your root repository
  2. Update Gradle wrapper: distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

in file: gradle-wrapper.properties

  1. Sync Gradle again
Andrii Kovalchuk
  • 4,351
  • 2
  • 36
  • 31