冲突的版本

Conflicting versions

我正在尝试在我的 android 项目中实施 gms-vision:18.0.0。 我的 gradle 文件中也有 'com.android.support:appcompat-v7:28.0.0'。然而,当我去同步我的项目时,我得到一个错误

ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:6:5-23:19 to override.

我的Gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.randomsoft.gmccustomerorders"
        minSdkVersion 28
        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'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.jakewharton:butterknife:8.5.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.android.gms:play-services-vision:18.0.0'
}

任何建议。这可能很明显,但我对 android 编程还是很陌生,我正在使用 Android Studio v3.4.2.

我认为这是因为 androidX 和 appCompact 的依赖性问题。 Google 播放服务支持 androidX,但您在应用程序中使用 appCompact,导致清单无法合并。

我建议您从 appCompact 更新到 androidX。现在哪个更靠谱

我希望你参考这个 link Migrating to AndroidX

如果您仍然遇到任何问题,请告诉我。