35

I have a unity project I am exporting that project as android studio project while opening the android studio project I am getting this error

Gradle sync failed: Could not find manifest-merger.jar
    (com.android.tools.build:manifest-merger:26.0.1).
    Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/build/manifest-merger/26.0.1/manifest-merger-26.0.1.jar

I have a few old exported project that was working fine before but today they are also giving the same error.

Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121
Ayush Malviya
  • 991
  • 1
  • 7
  • 20

4 Answers4

54

I finally fixed the issue. This may be a workaround but it works. So if anyone having this issue, just follow this:

  1. Swap the position of jcenter() and google() in project gradle file and in also all the other module you have in your project. Like in mine I have crashlytics, fabric so just remember to make the changes in their build.gradle file as well:

    buildscript {
        repositories {
            jcenter()
            google()
        }
    }
    

    to

    buildscript {
        repositories {
            google()
            jcenter()
        }
    }
    
  2. Before building your project again go to your project folder and delete the .gradle folder from your project and then build your project.

Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121
Ayush Malviya
  • 991
  • 1
  • 7
  • 20
16
  1. Go to Publishing Settings/Build, enable Custom Gradle Template
  2. Go to Assets/Plugins/Android/mainTemplate.gradle and change the postion from
  buildscript {
    repositories {
        jcenter()
        google()
}

to


 buildscript {
   repositories {
      google()
      jcenter()
}
  1. Remove gradle cache and rebuild. For Mac you can run rm -rf $HOME/.gradle/caches/ in terminal.
Vincent Plus
  • 250
  • 1
  • 7
0

Jcenter no longer hosts google dependencies, these can be resolved from "https://maven.google.com" so you can simply add that to the resolvers list along with jcenter.

Regards, Itamar

Itamarb
  • 111
  • 3
0

The problem is definitely having jcenter() above google(). However for me, my build.gradle was correct. The problem happened because of one of my dependencies library had that problem. The problem seemingly started happening out of nowhere, probably because my jar was cached.

I solved the problem by upgrading my problematic library to latest version as that contained a fix.

Eric Kim
  • 10,617
  • 4
  • 29
  • 31