Search code examples
androidmavenandroid-studiogradletwitter-fabric

Conflict between allprojects repository setting and Fabric


I had an issue with gradle thinking I wanted multidex 1.0.2 so I setup the repository in the top level build file and moved it out of the buildscript (as per: Android Studio 3.0 Beta 1: Failed to resolve: com.android.support:multidex:1.0.2):

allprojects {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }
}

However, Fabric seems to dislike this. In the buildscript sections of my project (and library) I have:

buildscript {
    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

And now I get:

Error:Could not find any matches for io.fabric.tools:gradle:1.+ as no versions of io.fabric.tools:gradle are available.
Searched in the following locations:
    file:/Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/io/fabric/tools/gradle/maven-metadata.xml
    file:/Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/io/fabric/tools/gradle/
    https://jcenter.bintray.com/io/fabric/tools/gradle/maven-metadata.xml
    https://jcenter.bintray.com/io/fabric/tools/gradle/
Required by:
    project :

How can I resolve this conflict? How to I specify to fabric, if not in all projects, where to get its own dependencies?


Solution

  • A colleague managed to resolve it with the following declaration in the app's build.gradle file:

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