簡體   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