简体   繁体   English

如何修复 Android Studio 中的类重复错误

[英]how to Fix Class duplication errors in Android studio

I am trying to add Firebase in the build.gradle file.我正在尝试在 build.gradle 文件中添加 Firebase。 However, it doesn't seem to be working.但是,它似乎不起作用。 this is my build.gradle file and below is the error.这是我的 build.gradle 文件,下面是错误。 I even looked some previous stack-overflow question but they didn't work so please help me out.!我什至看了一些以前的堆栈溢出问题,但它们没有用,所以请帮帮我。!

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
googleServices.disableVersionCheck = true
android {
    compileSdkVersion 29
    buildToolsVersion "30.0.1"

    defaultConfig {
        applicationId "com.teachbrowniesindia.textrecognizer"
        minSdkVersion 19
        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:1.1.3'
    implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    implementation 'com.google.android.gms:play-services-ads:19.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}


Error错误

Duplicate class com.google.android.gms.internal.vision.zzf 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-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.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-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.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-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.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-services-vision-common:19.1.0)
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-services-vision-common:19.1.0)
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) and jetified-play-services-vision-common-19.1.0-runtime.jar (com.google.android.gms:play-services-vision-common:19.1.0)

Go to the documentation to learn how to Fix dependency resolution errors.

目前修复似乎是将24.0.3 firebase-ml-vision降级到24.0.3

Going forward, ML Kit is offered as a Standalone SDK.展望未来,ML Kit 作为独立 SDK 提供。 To avoid issues like these, please migrate your app by following the migration guide .为避免此类问题,请按照迁移指南迁移您的应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Android Studio中导入项目后如何修复错误 - How to fix errors after import project in Android Studio 如何修复 android 工作室的所有/大多数依赖错误 - How to fix all/most dependency errors for android studio 如何修复 Android Studio 中的错误:xxx 不是封闭的 class - How to fix an error in Android Studio: xxx is not an enclosing class 如何在 Android Studio 中修复 Blankwebview - How to fix Blankwebview in Android studio 如何修复OutOfMemoryError Android Studio - how to fix OutOfMemoryError android studio 如何修复 XML 中阻止在 Android Studio 上显示预览或运行应用程序的错误(红色文本)? - How can I fix errors (red texts) in XML which are preventing from showing preview or running the app on Android Studio? 如何在 Android Studio 中使用导航架构修复(错误:找不到符号类 ActionOnlyNavDirections) - How to fix (error: cannot find symbol class ActionOnlyNavDirections) with navigation architecture in Android studio 如何解决Android Studio上编译时未找到与.class相关的文件的错误? - How do I resolve .class-related file not found errors in Android Studio on compile? Java:如何修复多种方法中的代码重复? - Java: How to fix code duplication in multiple methods? 如何修复 Android Studio 中的“Incompatible Types”错误? - How to fix "Incompatible Types" error in Android Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM