Gradle中的多个maven存储库

时间:2015-07-30 16:25:03

标签: android maven android-studio gradle

我有以下build.gradle:

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

        maven {
            url "https://dl.bintray.com/fyber/maven"
        }

        maven {
            url "https://dl.bintray.com/supersonic/android-sdk"
        }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.19.1'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

dependencies {
// Ads
      compile 'com.supersonic.sdk:mediationsdk:6.1.0@jar'
}

我收到了这个错误:

  

错误:(88,13)无法解决:   com.supersonic.sdk:mediationsdk:6.2.0

我已检查存储库中是否存在该库。为什么我会收到此错误?

1 个答案:

答案 0 :(得分:28)

您已将这些存储库添加到buildscript repositories列表中。因此,这些存储库仅用于dependencies中列出的buildscript

您需要repositories之外的buildscript关闭 ,列出您的顶级dependencies所在的存储库。所以,你想要的可能是:

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

        maven {
            url "https://dl.bintray.com/fyber/maven"
        }   
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.19.1'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

repositories {
        maven {
            url "https://dl.bintray.com/supersonic/android-sdk"
        }
}

dependencies {
// Ads
      compile 'com.supersonic.sdk:mediationsdk:6.1.0@jar'
}