【问题标题】:Duplicate class com.google.android.gms.internal.vision.zze found in modules jetified-play-services-vision-20.0.0-runtime在模块 jetified-play-services-vision-20.0.0-runtime 中发现重复的类 com.google.android.gms.internal.vision.zze
【发布时间】:2021-03-21 02:33:06
【问题描述】:

当我使用 Android Studio 时,会出现此错误。伤心.. 我尝试了很多东西,但它不起作用。

这是错误代码。


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)但发生了这个错误。 )

【问题讨论】:

    标签: java android android-studio


    【解决方案1】:

    这是因为您同时使用 Play services ml 服务firebase ml 库。如果您的要求只有这一项: https://firebase.google.com/docs/ml/android/recognize-landmarks

    移除这个依赖

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

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

    【讨论】:

      猜你喜欢
      • 2022-11-11
      • 2020-09-12
      • 2022-11-16
      • 2023-02-14
      • 2022-07-22
      • 2021-10-13
      • 1970-01-01
      • 2021-10-13
      相关资源
      最近更新 更多