TL;博士
在jcenter访问kodein core包是未经授权的。
细节
我们使用kodein进行依赖注入,但是当gradle尝试下载任何工件时,jcenter服务器突然返回Unauthorized
。
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not resolve org.kodein.di:kodein-di-framework-android-x:6.1.0.
Required by:
project :app
> Could not resolve org.kodein.di:kodein-di-framework-android-x:6.1.0.
> Could not get resource 'https://jitpack.io/org/kodein/di/kodein-di-framework-android-x/6.1.0/kodein-di-framework-android-x-6.1.0.pom'.
> Could not HEAD 'https://jitpack.io/org/kodein/di/kodein-di-framework-android-x/6.1.0/kodein-di-framework-android-x-6.1.0.pom'.
Received status code 401 from server: Unauthorized
> Could not resolve org.kodein.di:kodein-di-generic-jvm:6.1.0.
Required by:
project :app
> Could not resolve org.kodein.di:kodein-di-generic-jvm:6.1.0.
> Could not get resource 'https://jitpack.io/org/kodein/di/kodein-di-generic-jvm/6.1.0/kodein-di-generic-jvm-6.1.0.pom'.
> Could not HEAD 'https://jitpack.io/org/kodein/di/kodein-di-generic-jvm/6.1.0/kodein-di-generic-jvm-6.1.0.pom'.
Received status code 401 from server: Unauthorized
它也被报道为issue by Kodein-DI community。
是否可以从其他服务器获取工件?
最佳答案
虽然无法重新建立对jcenter的访问,但此快速入侵允许编译项目:
allprojects {
repositories {
google()
jcenter()
maven {
url 'http://dl.bintray.com/kotlin/kotlin-eap'
content {
includeGroup "org.kodein"
}
}
maven { url 'https://jitpack.io' }
maven { url 'https://dl.bintray.com/kodein-framework/Kodein-DI' }
}
}
基本上它忽略了jitpack中的kodein工件,而是从bintray下载它们。