在模块jetified-play-services-vision-20.0.0-runtime中找到重复类com.google.android.gms.internal.vision.zze

xmq68pz9  于 2021-06-30  发布在  Java
关注(0)|答案(1)|浏览(607)

当我使用androidstudio时,会发生这个错误。悲伤。。我试了很多东西,但都没用。
这是错误代码。

Duplicate class com.google.android.gms.internal.vision.zze found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzf found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzg found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzh found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzi found in modules jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)

这是build.gradle(模块:app)

plugins {
   id 'com.android.application'

}
apply plugin: 'com.google.gms.google-services'

android {
   compileSdkVersion rootProject.ext.compileSdkVersion
   buildToolsVersion "30.0.2"

   defaultConfig {
       applicationId "com.example.landmarkclass"
       minSdkVersion 21
       targetSdkVersion 30
       versionCode 1
       versionName "1.0"

       testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
   }

   buildTypes {
       release {
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
       }
   }
   compileOptions {
       sourceCompatibility JavaVersion.VERSION_1_8
       targetCompatibility JavaVersion.VERSION_1_8
   }
}

dependencies {
   implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"

   implementation 'androidx.appcompat:appcompat:1.2.0'
   implementation 'com.google.android.material:material:1.2.1'
   implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
   testImplementation 'junit:junit:4.+'
   androidTestImplementation 'androidx.test.ext:junit:1.1.2'
   androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
   implementation platform('com.google.firebase:firebase-bom:26.1.0')
   implementation 'com.google.firebase:firebase-analytics'
   implementation 'com.google.android.gms:play-services-vision'

   implementation 'com.google.firebase:firebase-ml-vision'

}

这是build.gradle项目

buildscript {
   repositories {
       google()
       jcenter()
   }
   dependencies {
       classpath "com.android.tools.build:gradle:4.1.1"
       classpath 'com.google.gms:google-services:4.3.3'
   }
}

allprojects {
   repositories {
       google()
       jcenter()
   }
}

ext {
   compileSdkVersion = 28
   supportLibVersion = "28.0.0"

}

谢谢您!
(我想关注这个网站,(https://firebase.google.com/docs/ml/android/recognize-landmarks )但会出现此错误。)

h5qlskok

h5qlskok1#

这是因为您同时使用play services ml服务和firebase ml库。如果您的要求仅此一项:https://firebase.google.com/docs/ml/android/recognize-landmarks
删除此依赖项

implementation 'com.google.android.gms:play-services-vision'

然后同步并运行。希望这能奏效。

相关问题