无法获取Android架构组件的资源

Nom*_*sta 1 android android-studio android-gradle-plugin android-architecture-components

我通过将这些行添加到build.gradle来应用于我的项目Android Architecture Components:

// Android Architecture Lifecycle
compile "android.arch.lifecycle:runtime:1.0.0-alpha1"
compile "android.arch.lifecycle:extensions:1.0.0-alpha1"
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha1"

// Android Architecture Room
compile "android.arch.persistence.room:runtime:1.0.0-alpha1"
compile "android.arch.persistence.room:rxjava2:1.0.0-alpha1"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha1"
Run Code Online (Sandbox Code Playgroud)

它工作,但在将Android Studio更新为Canary 3版本后,我仍然在编译时遇到此错误

错误:org.gradle.api.resources.ResourceException:无法获取资源' https://jitpack.io/android/arch/lifecycle/runtime/1.0.0-alpha1/runtime-1.0.0-alpha1.pom '.

错误:org.gradle.api.UncheckedIOException:无法HEAD ' https://jitpack.io/android/arch/lifecycle/runtime/1.0.0-alpha1/runtime-1.0.0-alpha1.pom '.从服务器收到状态码401:未经授权

...来自库的其他poms具有相同的错误.

我尝试重新启动Android Studio,卸载应用程序,当然还有clean-rebuild.

Com*_*are 5

您需要将Google正在使用的新公共Maven仓库添加到您的build.gradle文件中.

例如,您可以将其添加到allprojects顶级build.gradle文件中的闭包中:

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }
}
Run Code Online (Sandbox Code Playgroud)

然后,app/除了工件的其他位置之外,所有模块(例如)都会知道在那里查看.

从您的错误消息中可以看出Android Studio只是在寻找jitpack.io.