我刚刚将我的Eclipse Android
项目移动到Android Studio
,我有一个应用程序模块和一个库模块。
库模块在其build.gradle
中包含一些3rd party dependencies
,如下所示:
repositories {
maven {
url "https://api.bitbucket.org/1.0/repositories/3_party
credentials{
username 'XXXXXX'
password 'XXXXXX'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.xxx.sdk:'
}
现在,库项目编译得很好,并且它也能够从存储库中获取依赖项,在本例中是bitbucket。
但是一旦我在应用程序模块中包含库模块,我就开始收到一个错误,其中应用程序模块试图解决3rd party dependency
,这应该由库来解决,
Could not resolve all dependencies for configuration ':xxxx:_debugCompile'.
> Could not find com.xxxx.sdk:sdk:1.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/xxx/sdk/sdk/1.0.0/sdk-1.0.0.pom
https://jcenter.bintray.com/com/xxx/sdk/sdk/1.0.0/sdk-1.0.0.aar
我如何解决这个依赖的问题?
您必须在主模块中克隆repo信息。
主模块必须知道从哪个仓库下载依赖项。
然后加入mainModule/build.gradle
repositories {
maven {
url "https://api.bitbucket.org/1.0/repositories/3_party
credentials{
username 'XXXXXX'
password 'XXXXXX'
}
}
}