当前位置: 首页 > 知识库问答 >
问题:

Android Studio更新后classes.jar构建项目中的重复类

伍嘉
2023-03-14

我最近更新了Android Studio到最新版本,因为我一直面临着连接到它的库的问题。

面临的最新问题如下:

Cause 1: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Duplicate class     com.google.android.gms.internal.measurement.zzsr found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.internal.measurement.zzss found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.internal.measurement.zzst found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.internal.measurement.zzsu found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.internal.measurement.zzsv found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzcu found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzcv found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzcw found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzcx found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzcy found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzdw found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)

Go to the documentation to learn how to Fix dependency resolution errors.
at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
at com.android.ide.common.workers.ExecutorServiceAdapter.await(ExecutorServiceAdapter.kt:56)
at com.android.build.gradle.internal.tasks.CheckDuplicateClassesDelegate.run(CheckDuplicateClassesDelegate.kt:71)
at com.android.build.gradle.internal.tasks.CheckDuplicateClassesTask.taskAction(CheckDuplicateClassesTask.kt:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:48)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:702)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:669)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:404)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:393)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:376)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:213)
at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
at java.util.Optional.orElseGet(Optional.java:267)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:201)
at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
at java.util.Optional.map(Optional.java:215)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:77)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:120)
at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Duplicate class com.google.android.gms.internal.measurement.zzsr found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.internal.measurement.zzss found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.internal.measurement.zzst found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.internal.measurement.zzsu found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.internal.measurement.zzsv found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzcu found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzcv found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzcw found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzcx found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzcy found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)
Duplicate class com.google.android.gms.measurement.internal.zzdw found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.1)

Go to the documentation to learn how to Fix dependency resolution errors.
at com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable.run(CheckDuplicateClassesDelegate.kt:132)
at com.android.ide.common.workers.ExecutorServiceAdapter$submit$submission$1.run(ExecutorServiceAdapter.kt:40)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinTask.externalInterruptibleAwaitDone(ForkJoinTask.java:361)
at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1001)
... 99 more

在应用程序Gradle下方查找:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'


android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    useLibrary  'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.packageName"
        minSdkVersion 24
        targetSdkVersion 28
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }

    lintOptions {
        disable "ResourceType"
    }
}

ext {
    googlePlayServicesVersion = "4.2.0"
}


dependencies {
    implementation files('libs/icu4j-4_4_2_2.jar')
    implementation files('libs/jsoup-1.6.3.jar')
    implementation files('libs/ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar')
    implementation files('libs/zip4j_1.2.6.jar')

    implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar')     {
        transitive = true;
    }

    implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation'com.google.firebase:firebase-auth:16.1.0'

    // Firebase
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-core:16.0.3'

    implementation 'com.google.android.gms:play-services-ads:17.2.1'

    implementation project(':pdflibrary')
    implementation 'com.android.support:support-compat:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation'junit:junit:4.12'

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'

    implementation 'com.google.android.gms:play-services-flags:16.0.1'   
}

在pdf库Gradle下方找到:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 28
        versionCode 1
        versionName '1'
    }

    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
}

在项目评级下方找到:

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
        google()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'io.fabric.tools:gradle:1.29.0'
        classpath 'com.google.gms:google-services:4.1.0'
    }

}

allprojects {
    repositories {
        mavenCentral()
        google()
        maven { url 'https://maven.fabric.io/public' }
        jcenter()
    }
}

我已经检查了以下问题,但没有建议会起作用: Android Studio:解决重复类

这可能是以下问题的重复: 61classes.jar的重复班级,classes.jar在哪里?但不幸的是,没有得到答复。我希望这能引起人们对这个问题的关注。

共有1个答案

糜正业
2023-03-14

我也面临同样的问题。添加firebase libray后我的问题就解决了。所以希望对你有帮助。

 api 'com.google.firebase:firebase-core:17.2.0'
 类似资料:
  • 我运行的是Mac OSX,我安装了android Studio-它启动正常。 问题1 我用一个空活动开始一个新项目。在最上面的窗户上我收到一条信息 问题2 我在底部窗口中看到以下错误: 错误:CompilesDKVersion android-L需要使用JDK 7 Open SDK Settings进行编译 打开文件 当我尝试在设备上运行项目时,我得到以下错误: 失败[INSTALL_FAILED

  • 操作步骤: 菜单栏:Build --> Rebuild Project(重新构建项目)

  • 我在片段的底部有一个水平图像滑块。片段的顶部显示了一些细节。一旦用户点击底部的图像,想法是从图像滑块中删除该图像,并在片段中显示其信息。现在,信息显示出来,但图像不会从中删除。下面是我在最外层布局的中编码的内容。我试过了所有我能找到的相关答案,但都没有奏效。它们都在代码里。请让我知道我做错了什么或者错过了什么。 适配器的完整代码 }

  • 如何避免Cxense SDK中肯定包含的重复类?

  • 我正在使用标记从Docker运行Jenkins。这个标记后面是版本。现在有一个新的版本:。Docker不会自动检查它。我必须执行以获得新版本。 但是如何检查标签是否有更新的构建呢? 编辑:我想说明:这不是复制品!我问如何检查更新的Docker图像可用。我知道如何升级(正如我上面所说的)。