2

TL; 博士

在 JCenter 访问 Kodein 核心包是未经授权的。

细节

Unauthorized我们正在使用 Kodein 进行依赖注入,但是当 Gradle 尝试下载任何org.kodein.*工件时,JCenter 服务器突然返回。

* 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

它也被Kodein-DI 社区报告为一个问题

是否可以从另一台服务器获取工件?

4

2 回答 2

3

虽然没有重新建立对 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 下载它们

于 2019-05-08T09:10:57.533 回答
1

在您的项目级 build.gradle 文件中添加以下代码并同步项目:

allprojects {
    repositories {
        google()
        jcenter()
        maven {url "https://jitpack.io"}
        maven { url "https://dl.bintray.com/kodein-framework/Kodein-DI" }
    }
}

访问了解更多详情

于 2020-07-14T00:23:59.183 回答