我正在尝试将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 'maven.google' } 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.
推荐答案您已经添加了Build.gradle中的nofollow noreferrer> google() ,因此,请尝试添加最新版本:
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
发布评论