无法解析android.arch.lifecycle:extensions:1.1.0 [英] Could not resolve android.arch.lifecycle:extensions:1.1.0

查看:782
本文介绍了无法解析android.arch.lifecycle:extensions:1.1.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将lifecycle:extensions添加到我的项目中,但是我无法使其正常工作.每次显示错误.

I am trying to add lifecycle:extensions to my project but i can not make it work . Each time it shows error .

无法解析':app @ debug/compileClasspath'的依赖关系:无法解析android.arch.lifecycle:extensions:1.1.0.

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve android.arch.lifecycle:extensions:1.1.0.

我已经阅读了多个线程,但无法通过此处给出的答案使其正常工作. 项目级别的收益是:

I have already read several threads but could not make it work by the answers given there. Project level gradle is:

buildscript {
repositories {
   google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
}
}

allprojects {
repositories {
    google()
    maven { url 'https://maven.google.com' }
    jcenter()
    mavenCentral()
    flatDir {
        dirs 'libs'
    }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

build.gradle是:

And build.gradle is :

implementation "android.arch.lifecycle:extensions:1.1.0"
annotationProcessor "android.arch.lifecycle:compiler:1.1.0"

我如何使其起作用?我在Android Studio 3.1.2上.我也尝试导入一些github示例,但是每次都发生相同的错误.现在已经7个小时了,我一直在努力解决这个问题.

How can i make it work? I am on Android Studio 3.1.2 . I also tried to import some github samples but same error occurred each time . Now its been 7 hours i have been busting my head on this.

推荐答案

您已经添加了

You already added google() in the Build.gradle so, try adding the latest version:

implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"

另外,请转到:

File -> Settings -> Build, Execution, Deployment -> Build tools -> Gradle

如果已选择从存储库下载,请取消选中该选项.

And uncheck the option if it is checked to download from repository.

如果没有帮助,将gradle更新到最新版本将有所帮助:

In case it didn't help, updating gradle to the latest version will help:

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'
}

这篇关于无法解析android.arch.lifecycle:extensions:1.1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆