Конфликт зависимостей при добавлении Firebase ML-kit - PullRequest
0 голосов
/ 05 мая 2019

Я получаю следующий конфликт в зависимостях в приложении при добавлении набора firebase ml.Не знаете как решить эту проблему?

conflict in dependencies

1 Ответ

2 голосов
/ 05 мая 2019

Это просто предупреждающее сообщение или вам мешает успешная сборка?

В любом случае, исключая com.android.support, работает так же, как и у меня в моем проекте.

Публикация моих важных важных фрагментов из моего проекта, в котором используется ml-kit с targetSDK 28, и надеюсь, что эти изменения сработают и для вас.

Модуль грейдера:

    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'

Проект Gradle:

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 в основном зависят от версий, которые мы используем, и от внутренних дублирующих библиотек, используемых зависимостями. Так что опубликовал вещи вместе с зависимостями, которые работали для меня.

Надеюсь, это поможет вам.

...