如何解决此错误:在模块中找到重复的类 com.google.android.gms.internal.vision.zzw。

huangapple go评论94阅读模式
英文:

How to solve this error : Duplicate class com.google.android.gms.internal.vision.zzw found in modules

问题

  1. > **在模块 jetified-play-services-vision-20.0.0-runtime.jar (com.google.android.gms:play-services-vision:20.0.0) jetified-play-services-vision-common-19.1.0-runtime.jar (com.google.android.gms:play-se**
  2. apply plugin: 'com.android.application'
  3. apply plugin: 'kotlin-android'
  4. apply plugin: 'com.google.gms.google-services'
  5. googleServices {disableVersionCheck = true}
  6. android {
  7. compileSdkVersion 29
  8. defaultConfig {
  9. applicationId "com.greenhelix.pear"
  10. minSdkVersion 23
  11. targetSdkVersion 29
  12. versionCode 1
  13. versionName "1.0"
  14. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  15. }
  16. buildTypes {
  17. release {
  18. minifyEnabled false
  19. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  20. }
  21. }
  22. }
  23. dependencies {
  24. implementation fileTree(dir: "libs", include: ["*.jar"])
  25. implementation 'androidx.appcompat:appcompat:1.2.0'
  26. implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
  27. implementation 'com.google.firebase:firebase-auth:19.4.0'
  28. implementation 'com.google.firebase:firebase-ml-vision:24.0.3'
  29. // implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
  30. // implementation 'com.google.firebase:firebase-ml-vision-barcode-model:16.1.1'
  31. implementation 'com.google.firebase:firebase-core:17.5.1'
  32. implementation platform('com.google.firebase:firebase-bom:25.12.0')
  33. implementation 'com.google.firebase:firebase-analytics:17.6.0'
  34. implementation 'com.google.android.gms:play-services-auth:18.1.0'
  35. implementation 'com.google.android.gms:play-services-vision:20.1.2'
  36. implementation 'androidx.cardview:cardview:1.0.0'
  37. implementation 'com.github.bumptech.glide:glide:4.11.0'
  38. implementation 'androidx.recyclerview:recyclerview:1.1.0'
  39. implementation 'androidx.recyclerview:recyclerview-selection:1.1.0-rc03'
  40. testImplementation 'junit:junit:4.13.1'
  41. androidTestImplementation 'androidx.test.ext:junit:1.1.2'
  42. androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
  43. implementation 'androidx.core:core-ktx:1.3.2'
  44. implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
  45. }
  46. repositories {
  47. mavenCentral()
  48. }
英文:

> ** Duplicate class com.google.android.gms.internal.vision.zzv found in modules jetified-play-services-vision-20.0.0-runtime.jar (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime.jar (com.google.android.gms:play-se**

  1. apply plugin: 'com.android.application'
  2. apply plugin: 'kotlin-android'
  3. apply plugin: 'com.google.gms.google-services'
  4. googleServices {disableVersionCheck = true}
  5. android {
  6. compileSdkVersion 29
  7. defaultConfig {
  8. applicationId "com.greenhelix.pear"
  9. minSdkVersion 23
  10. targetSdkVersion 29
  11. versionCode 1
  12. versionName "1.0"
  13. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  14. }
  15. buildTypes {
  16. release {
  17. minifyEnabled false
  18. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  19. }
  20. }
  21. }
  22. dependencies {
  23. implementation fileTree(dir: "libs", include: ["*.jar"])
  24. implementation 'androidx.appcompat:appcompat:1.2.0'
  25. implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
  26. implementation 'com.google.firebase:firebase-auth:19.4.0'
  27. implementation 'com.google.firebase:firebase-ml-vision:24.0.3'
  28. // implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
  29. // implementation 'com.google.firebase:firebase-ml-vision-barcode-model:16.1.1'
  30. implementation 'com.google.firebase:firebase-core:17.5.1'
  31. implementation platform('com.google.firebase:firebase-bom:25.12.0')
  32. implementation 'com.google.firebase:firebase-analytics:17.6.0'
  33. implementation 'com.google.android.gms:play-services-auth:18.1.0'
  34. implementation 'com.google.android.gms:play-services-vision:20.1.2'
  35. implementation 'androidx.cardview:cardview:1.0.0'
  36. implementation 'com.github.bumptech.glide:glide:4.11.0'
  37. implementation 'androidx.recyclerview:recyclerview:1.1.0'
  38. implementation 'androidx.recyclerview:recyclerview-selection:1.1.0-rc03'
  39. testImplementation 'junit:junit:4.13.1'
  40. androidTestImplementation 'androidx.test.ext:junit:1.1.2'
  41. androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
  42. implementation 'androidx.core:core-ktx:1.3.2'
  43. implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
  44. }
  45. repositories {
  46. mavenCentral()
  47. }

答案1

得分: 5

清理构建对我没有起作用,不幸的是。将'com.google.fire:firebase-ml-vision'从'implementation'更改为'compileOnly'似乎已经解决了直接的问题。

  1. compileOnly 'com.google.firebase:firebase-ml-vision'
英文:

Clean build did not work for me unfortunately. Changing 'com.google.fire:firebase-ml-vision' from 'implementation' to 'compileOnly' seems to have sorted the immediate problem.

  1. compileOnly 'com.google.firebase:firebase-ml-vision'

答案2

得分: 1

这绝对是您的Google Play服务和Jetify Play服务之间的冲突。尝试执行 - 清理 > 构建。

英文:

This is 100% a conflict between your Google Play services and Jetify Play services. try - Clean > Build

答案3

得分: 1

更新firebase-bom的依赖项(它不会自动建议更新)

implementation platform('com.google.firebase:firebase-bom:30.5.0')

英文:

Update the dependency for firebase-bom (it does not autosuggest updates)

implementation platform('com.google.firebase:firebase-bom:30.5.0')

huangapple
  • 本文由 发表于 2020年10月20日 18:14:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/64443018.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定