Android gradle库与应用程序模块的集成问题
我刚刚将我的Android gradle库与应用程序模块的集成问题,android,android-studio,gradle,android-gradle-plugin,build.gradle,Android,Android Studio,Gradle,Android Gradle Plugin,Build.gradle,我刚刚将我的eclipseandroid项目移动到androidstudio,我有一个应用程序模块和一个库模块 库模块在其build.gradle中包含一些第三方依赖项,如下所示: repositories { maven { url "https://api.bitbucket.org/1.0/repositories/3_party credentials{ username 'XXXXXX' passw
eclipseandroid
项目移动到androidstudio
,我有一个应用程序模块和一个库模块
库模块在其build.gradle
中包含一些第三方依赖项,如下所示:
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
但是,一旦我将库模块包括在应用程序模块中,我就开始接收到一个错误,其中应用程序模块尝试解决第三方依赖关系
,应该由库来解决
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
如何解决此依赖关系的问题?您必须在主模块中克隆回购信息。
主模块必须知道maven repo在哪里下载依赖项
然后添加main模块/build.gradle
repositories {
maven {
url "https://api.bitbucket.org/1.0/repositories/3_party
credentials{
username 'XXXXXX'
password 'XXXXXX'
}
}
}
如果您可以显示完整的包名,而不是compile'com.xxx.sdk:“
无法显示包名,即客户端不希望公开的专有第三个库,这将非常有用。我可以告诉你的一件事是,依赖项不在jcenter中,而是在库中定义的位桶repo中。gradleHey,谢谢Gabriele,那天我已经知道了这一点,但在gradle依赖项的另一个问题上卡住了。如果其他用户也发现这个问题,我将对此进行标记。尽管我有一个问题,库gradle中的依赖项是否也应该移动到man模块gradle。因为我看到EclipseGradleExport插件正在做这件事。不,这不是必需的,因为您使用的是maven repo。pom文件包含依赖项列表,gradle下载这些依赖项。