出于某种原因,特拉维斯 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
最佳答案
Cannot resolve external dependency com.android.tools.build:gradle:2.2.2 because no repositories are defined
在 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)'
}
关于android - 无法解析外部依赖 com.android.tools.build :gradle:2. 2.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42173017/