问题描述
下面是我的应用程序模块的应用程序建设摇篮的样子:
Here is how my application module 'app' build gradle looks like:
apply plugin: 'com.android.application'
repositories {
maven { url 'http://localhost:8080/repository/internal/' }
}
...
dependencies {
compile 'org.apache.httpcomponents:httpmime:4.2.3'
compile 'com.testpackage.networking:networking:1.0.3'
}
和它工作得很好。我试图使用相同的依赖在我的名为librarymodule库模块。下面是它的build.gradle是这样的:
and it works just fine. I'm trying to use same dependency in my library module named 'librarymodule'. Here is how its build.gradle looks like:
apply plugin: 'com.android.library'
repositories {
maven {
url 'http://localhost:8080/repository/internal/'
}
}
...
dependencies {
compile 'org.apache.httpcomponents:httpmime:4.2.3'
compile 'com.testpackage.networking:networking:1.0.3'
}
的唯一区别是com.android.library这里使用VS在应用程序模块。
The only difference is gradle plugin 'com.android.library' used here vs 'com.android.application' used in 'app' module.
错误:出现在配置项目中的问题:应用程序。 未能解决所有依赖关系配置:应用程序:_debugCompile。 找不到com.testpackage.networking:网络:1.0.3。 搜索在以下位置: 的 的 file:/Users/myusername/Library/Android/sdk/extras/android/m2repository/com/testpackage/networking/networking/1.0.3/networking-1.0.3.pom file:/Users/myusername/Library/Android/sdk/extras/android/m2repository/com/testpackage/networking/networking/1.0.3/networking-1.0.3.jar file:/Users/myusername/Library/Android/sdk/extras/google/m2repository/com/testpackage/networking/networking/1.0.3/networking-1.0.3.pom file:/Users/myusername/Library/Android/sdk/extras/google/m2repository/com/testpackage/networking/networking/1.0.3/networking-1.0.3.jar 要求: LibrariesApplication:应用程序:未指定> LibrariesApplication:librarymodule:未指定
所以,因某种原因没有 http://localhost:8080/repository/internal/com/testpackage/networking/networking/1.0.3/networking-1.0.3.pom下的搜索在以下位置列表中。
So, for some reason there is no http://localhost:8080/repository/internal/com/testpackage/networking/networking/1.0.3/networking-1.0.3.pom under Searched in the following locations list.
这不仅是我的仓库的问题。我可以如使用
It's not only my repository problems. I can for example use
maven { url 'https://mint.splunk.com/gradle/' }
与依赖库
compile 'com.splunk.mint:mint:4.1'
和仍然得到同样的错误
有谁知道如何解决这个问题?
Does anyone knows how to fix that?
推荐答案
这是一个有点怪,但添加自定义库根build.gradle的allprojects实际工作!
This is a bit strange but adding custom repository to 'allprojects' of root build.gradle actually worked!
allprojects {
repositories {
jcenter()
maven {
url 'http://localhost:8080/repository/internal/'
}
}
}
这篇关于摇篮插件“com.android.library'不定制Maven仓库搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!