繁体   English   中英

添加Firebase ML-kit时相关性冲突

[英]Dependencies conflict when adding firebase ML-kit

添加firebase ml套件时,我在应用程序gardle中的依赖项中遇到以下冲突。 不知道该如何解决?

依赖冲突

这仅仅是警告消息还是使您无法成功构建?

无论如何,除了com.android.support之外,它都可以在我的项目中为我工作。

将我的gradle重要片段从我的项目中发布,该项目使用了带有targetSDK 28的ml-kit,希望这些更改对您也有用。

模块gradle:

    android{

    defaultConfig {

            /.. bla bla bla ....
            multiDexEnabled true
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
     buildTypes {
            release {
                minifyEnabled false
                //...
            }
        }
     compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }

    configurations.all {   //this piece is important to avoid duplicates
        exclude group: 'com.android.support',
                module: 'support-v4' 
    }

    }


dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation('com.android.support:design:28.0.0') {
//        exclude group: 'com.android.support', module: 'support-annotations' 
//  enable this if still issue exists
    }
    implementation 'com.android.support:support-v4:28.0.0'
    implementation('com.android.support:appcompat-v7:28.0.0') {
//        exclude group: 'com.android.support', module: 'support-annotations'
    }
    implementation 'com.android.support:palette-v7:28.0.0'
    implementation 'com.android.support:multidex:1.0.0'
    implementation 'com.google.firebase:firebase-ml-vision:18.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation('com.squareup.retrofit2:retrofit:2.5.0') {
        // exclude Retrofit’s OkHttp dependency module and define your own module import
        exclude module: 'okhttp'
    }
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    // Dependencies for working withRepoContract Architecture components
    // You'll probably have to update the version numbers in guild.gradle (Project)
    implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
    annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
    implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
    annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"

    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'
}
apply plugin: 'com.google.gms.google-services'

项目摇篮:

buildscript {
     repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.google.gms:google-services:3.2.0' // google-services plugin

        classpath 'com.android.tools.build:gradle:3.3.1'

      }
}

allprojects {
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
ext {
    roomVersion = '1.1.1'
    archLifecycleVersion = '1.1.1'
}

Gradle依赖项错误主要取决于我们使用的版本以及依赖项所使用的内部重复库。 所以发布的东西以及对我有用的依赖项。

希望这对您的修复有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM