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

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

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

问题

> **在模块 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**


apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
googleServices {disableVersionCheck = true}

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "com.greenhelix.pear"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
    implementation 'com.google.firebase:firebase-auth:19.4.0'
    implementation 'com.google.firebase:firebase-ml-vision:24.0.3'
//    implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
//    implementation 'com.google.firebase:firebase-ml-vision-barcode-model:16.1.1'
    implementation 'com.google.firebase:firebase-core:17.5.1'
    implementation platform('com.google.firebase:firebase-bom:25.12.0')
    implementation 'com.google.firebase:firebase-analytics:17.6.0'
    implementation 'com.google.android.gms:play-services-auth:18.1.0'
    implementation 'com.google.android.gms:play-services-vision:20.1.2'

    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.recyclerview:recyclerview-selection:1.1.0-rc03'

    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

repositories {
    mavenCentral()
}
英文:

> ** 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**

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
googleServices {disableVersionCheck = true}

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "com.greenhelix.pear"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
    implementation 'com.google.firebase:firebase-auth:19.4.0'
    implementation 'com.google.firebase:firebase-ml-vision:24.0.3'
//    implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
//    implementation 'com.google.firebase:firebase-ml-vision-barcode-model:16.1.1'
    implementation 'com.google.firebase:firebase-core:17.5.1'
    implementation platform('com.google.firebase:firebase-bom:25.12.0')
    implementation 'com.google.firebase:firebase-analytics:17.6.0'
    implementation 'com.google.android.gms:play-services-auth:18.1.0'
    implementation 'com.google.android.gms:play-services-vision:20.1.2'

    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.recyclerview:recyclerview-selection:1.1.0-rc03'

    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"


}
repositories {
    mavenCentral()
}

答案1

得分: 5

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

 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.

 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:

确定