I applied to my project Android Architecture Components, by adding this lines to build.gradle:
// 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"
It worked, but after updating Android Studio to Canary 3 version I'm still getting this error while compiling
Error:org.gradle.api.resources.ResourceException: Could not get resource 'https://jitpack.io/android/arch/lifecycle/runtime/1.0.0-alpha1/runtime-1.0.0-alpha1.pom'.
Error:org.gradle.api.UncheckedIOException: Could not HEAD 'https://jitpack.io/android/arch/lifecycle/runtime/1.0.0-alpha1/runtime-1.0.0-alpha1.pom'. Received status code 401 from server: Unauthorized
... other poms from library with the same error.
I tried restarting Android Studio, uninstalling app and of course clean-rebuild.
You need to add the new public Maven repo that Google is using to your build.gradle
file.
For example, you could add it to the allprojects
closure in the top-level build.gradle
file:
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
Then, all of your modules (e.g., app/
) will know to look there in addition to other places for the artifacts.
From your error message, it would appear that Android Studio is only looking in jitpack.io
.