尝试添加网格布局时如何处理“发现现有项目依赖项不一致”的问题

问题描述 投票:0回答:1

将网格布局拖放到我的应用程序设计中时,我收到以下消息:- 此操作需要库 com.android.support:gridlayout-v7:+。

问题:发现现有项目依赖项不一致。 版本之间不兼容: - com.android.support:appcompat-v7:28.0.0 和: - com.android.support:appcompat-v7:28.0.0

具有依赖关系: - com.android.support:support-annotations:26.1.0 相对: - com.android.support:支持注释:28.0.0

添加该库后项目可能无法编译。 您还想添加吗?

我该怎么办???请帮忙。

我只有 7 天的 Android 经验。 我正在使用适用于 Windows 64 位的 android 3.4.1。

以下是 gradle 依赖项:-

类路径'com.android.tools.build:gradle:3.4.0'

应用程序等级是:-

    apply plugin: 'com.android.application'
    android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.connect3"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

        }
    }
}


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

这是另一个带有项目名称的项目:-

    buildscript {
    repositories {
        google()
        jcenter()

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
                  }
                 }

    allprojects {
    repositories {
        google()
        jcenter()

                 }
                }

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


android android-gradle-plugin
1个回答
0
投票

不幸的是,我在这里遇到了同样的问题,我尝试了很多不同的方法来解决它,但我无法成功,尽管我分享了最实用和可疑的方法 一: 转到 gradle.properties 目录,然后在 android.useAndroidx = true 下方添加 android.enableJetifier = true

希望这对你有用

© www.soinside.com 2019 - 2024. All rights reserved.