[英]Dependencies conflict when adding firebase ML-kit
I am getting the following conflict in dependencies in app gardle while adding the firebase ml kit. 添加firebase ml套件时,我在应用程序gardle中的依赖项中遇到以下冲突。 Don't know how to resolve this ?
不知道该如何解决?
Is this just a warning message or stopping you from build success ? 这仅仅是警告消息还是使您无法成功构建?
Anyways excluding com.android.support
works as it worked for me in my project. 无论如何,除了
com.android.support
之外,它都可以在我的项目中为我工作。
Posting my gradle important bits and pieces from my project which uses ml-kit with targetSDK 28 and hope these changes works for you too. 将我的gradle重要片段从我的项目中发布,该项目使用了带有targetSDK 28的ml-kit,希望这些更改对您也有用。
Module gradle: 模块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'
Project 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 dependency errors mainly depend on versions we use and internal duplicate libs used by the dependencies. Gradle依赖项错误主要取决于我们使用的版本以及依赖项所使用的内部重复库。 So posted things along with dependencies those worked for me.
所以发布的东西以及对我有用的依赖项。
Hope this helps for your fix. 希望这对您的修复有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.