无法解决:添加 google 架构组件依赖项时出现 support-fragment 错误

2024-03-01

我想在我的应用程序中使用 Google 架构组件,但是在将 android studio 更新到版本 3.1.1 后,当我添加android.arch.lifecycle:extensions:1.1.1依赖到 app.gradle 文件,它会显示Failed to resolve: support-fragment
我的gradle版本是4.4

这是应用程序gardle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "ir.apptori.myapplication"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 
 "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    implementation "android.arch.lifecycle:extensions:1.1.1"
}

请指导我如何解决它,谢谢


我有一个类似的错误并改变repositories订购以便google()出现在之前jcenter()修复。

我不得不更改订单repositories within buildscript and allprojects在顶层build.gradle file.

请参阅此提交:https://github.com/kunadawa/ud851-Exercises/commit/9f6720ef4d52c71b206ddaa8477f2cf6e77a66f4 https://github.com/kunadawa/ud851-Exercises/commit/9f6720ef4d52c71b206ddaa8477f2cf6e77a66f4

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法解决:添加 google 架构组件依赖项时出现 support-fragment 错误 的相关文章

随机推荐