无法解决外部依赖关系com.android.tools.build:gradle:2.2.2

时间:2017-02-11 06:27:00

标签: android travis-ci

出于某种原因,travis build很难解决依赖关系。

A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApk'.
A problem occurred configuring project ':mortar'.
 Could not resolve all dependencies for configuration ':mortar:classpath'.
 Cannot resolve external dependency com.android.tools.build:gradle:2.2.2 because no repositories are defined.
Required by:
mortar-evolution-stone:mortar:unspecified

Travis Ci

1 个答案:

答案 0 :(得分:2)

  

无法解析外部依赖项com.android.tools.build:gradle:2.2.2,因为没有定义存储库

mortar/build.gradle你没有任何关系。

buildscript {
  dependencies {
    classpath 'com.android.tools.build:gradle:2.2.2'
  }
}

但是,你不应该那样......你的/build.gradle可以设置它。

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

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

allprojects {
    // *** Add this *** //
    buildscript {
        repositories {
            jcenter()
        }
    }

    repositories {
        jcenter()
    }
}

实际上,您的代码库中根本不需要mortar

app/build.gradle

dependencies {   
    ...
    // compile project(':mortar') // ** Remove this ** //
    compile 'com.squareup.mortar:mortar:(latest version)'
}