Program type already present: com.Google.gson.ExclusionStrategy
据我所见,我的项目中没有使用ExclusionStrategy.我真的不知道如何找到解决方案……
下面是完整的错误堆栈.
org.gradle.API.tasks.TaskExecutionException: Execution Failed for
task
‘:sample-mpa-ui:@R_404_4154@DexArchiveWithExternallibsDexMergerForMyProjectModelDeBUG’.
at org.gradle.API.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.API.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.API.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.API.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.API.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.API.internal.tasks.execution.ValIDatingTaskExecuter.execute(ValIDatingTaskExecuter.java:60)
at org.gradle.API.internal.tasks.execution.SkipEmptySourcefilesTaskExecuter.execute(SkipEmptySourcefilesTaskExecuter.java:97)
at org.gradle.API.internal.tasks.execution.CleanupStaleoutputsExecuter.execute(CleanupStaleoutputsExecuter.java:87)
at org.gradle.API.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.API.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.API.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.API.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.API.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processtask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: com.androID.builder.dexing.DexArchiveMergerException: Error while
merging dex archives:
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\0.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\1.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\2.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\3.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\4.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\5.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\6.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\7.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\8.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\9.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\10.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\11.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\12.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\13.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\14.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\15.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\16.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\17.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\18.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\19.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\20.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\21.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\22.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\23.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\24.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\25.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\26.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\27.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\28.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\29.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\30.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\31.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\32.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\33.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\34.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\35.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\36.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\37.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\38.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\39.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\40.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\41.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\42.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\43.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\44.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\45.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\46.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\47.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\48.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\49.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\50.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\51.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\52.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\53.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\54.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\55.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\56.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\57.jar
at com.androID.builder.profile.Recorder$Block.handleException(Recorder.java:55)
at com.androID.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
at com.androID.build.gradle.internal.pipeline.@R_404_4154@Task.@R_404_4154@(@R_404_4154@Task.java:212)
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:73)
at org.gradle.API.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
at org.gradle.API.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.API.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.API.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.API.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.API.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
… 32 more
Caused by: com.androID.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\0.jar,
C:\Sources\MyProject\build\intermediates\@R_404_4154@s\dexBuilder\MyProjectModel\deBUG\57.jar
at com.androID.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:124)
at com.androID.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:109)
at com.androID.build.gradle.internal.@R_404_4154@s.DexMerger@R_404_4154@Callable.call(DexMerger@R_404_4154@Callable.java:101)
at com.androID.build.gradle.internal.@R_404_4154@s.ExternallibsMerger@R_404_4154@.@R_404_4154@(ExternallibsMerger@R_404_4154@.kt:123)
at com.androID.build.gradle.internal.pipeline.@R_404_4154@Task$2.call(@R_404_4154@Task.java:221)
at com.androID.build.gradle.internal.pipeline.@R_404_4154@Task$2.call(@R_404_4154@Task.java:217)
at com.androID.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
… 48 more
Caused by: com.androID.tools.r8.CompilationFailedException: Compilation Failed to complete
at com.androID.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:76)
at com.androID.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:45)
at com.androID.tools.r8.D8.run(D8.java:88)
at com.androID.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:107)
… 53 more
Caused by: com.androID.tools.r8.utils.AbortException
at com.androID.tools.r8.utils.Reporter.failifPendingErrors(Reporter.java:77)
at com.androID.tools.r8.utils.Reporter.fatalError(Reporter.java:58)
at com.androID.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:67)
… 56 more
下面是项目的build.gradle
apply plugin:’com.androID.application’
def app_version = 'v0.0.1'def version = '0.0.1androID { compileSdkVersion project.ext.globalCompileSdkVersion buildToolsversion project.ext.globalBuildToolsversion defaultConfig { applicationID "com.sample.companyname" minSdkVersion project.ext.globalMinSdkVersion targetSdkVersion project.ext.globalTargetSdkVersion versionCode 74 versionname app_version multIDexEnabled true } compileOptions { //noinspection GroovyAssignabilityCheck sourceCompatibility JavaVersion.VERSION_1_7 //noinspection GroovyAssignabilityCheck targetCompatibility JavaVersion.VERSION_1_7 } // This has been added to deal with a duplicate file when using // apache commons-codec and commons-valIDators packagingOptions { pickFirst 'meta-inf/DEPENDENCIES.txt' pickFirst 'meta-inf/DEPENDENCIES' pickFirst 'meta-inf/dependencIEs.txt' pickFirst 'meta-inf/liCENSE.txt' pickFirst 'meta-inf/liCENSE' pickFirst 'meta-inf/license.txt' pickFirst 'meta-inf/LGPL2.1' pickFirst 'meta-inf/NOTICE.txt' pickFirst 'meta-inf/NOTICE' pickFirst 'meta-inf/notice.txt' } signingConfigs { deBUG { //noinspection GroovyAssignabilityCheck storefile file('../keystore/product.keystore') storePassword "dont" keyAlias "even" keyPassword "try" } release { //noinspection GroovyAssignabilityCheck storefile file('../keystore/product.keystore') storePassword "dont" keyAlias "even" keyPassword "try" } } //noinspection GroovyAssignabilityCheck buildTypes { deBUG { applicationIDSuffix ".deBUG" deBUGgable true } release { deBUGgable false MinifyEnabled true shrinkResources false proguardfiles getDefaultProguardfile('proguard-androID-optimize.txt'),'proguard-rules.pro' signingConfig signingConfigs.release } } flavorDimensions 'tIEr' productFlavors { sampleFlavor1 { dimension 'tIEr' } sampleFlavor2 { dimension 'tIEr' } sampleFlavor3 { dimension 'tIEr' } sampleFlavor4 { dimension 'tIEr' } } sourceSets { main.java.srcDirs = ['src/main/java'] } lintoptions { abortOnError false }}//noinspection GroovyAssignabilityCheckdependencIEs { // Project dependencIEs implementation project(':module-1') implementation project(':module-2') implementation project(':module-3') implementation project(':module-4') implementation project(':module-5') implementation(name: 'lib-a-2.1.1-release',ext: 'aar') implementation(name: 'lib-b-2.1.1-release',ext: 'aar') implementation(name: 'lib-c-2.1.1-release',ext: 'aar') implementation(name: 'lib-d-2.1.1-release',ext: 'aar') implementation 'com.Google.code.gson:gson:2.8.0' implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.3' implementation('commons-codec:commons-codec:1.10') implementation('commons-valIDator:commons-valIDator:1.4.0') { exclude group: 'commons-logging',module: 'commons-logging' exclude group: 'commons-digester',module: 'commons-digester' exclude group: 'commons-beanutils',module: 'commons-beanutils' exclude group: 'commons-collections',module: 'commons-collections' } implementation "com.Google.androID.gms:play-services-nearby:$play_services_version" implementation "com.Google.androID.gms:play-services-gcm:$play_services_version" implementation 'com.androID.support:multIDex:1.0.3' implementation "com.androID.support:appcompat-v7:$support_version" implementation "com.androID.support:design:$support_version" implementation "com.androID.support:support-annotations:$support_version" implementation "com.androID.support.constraint:constraint-layout:1.0.2" // Test dependencIEs androIDTestImplementation 'com.squareup.okhttp:mockwebserver:2.3.0' androIDTestImplementation 'com.jayway.androID.robotium:robotium-solo:5.2.1' testImplementation 'junit:junit:4.12'}解决方法 检查lib文件夹中是否有任何gson jar. 我在lib目录中遇到了同样的问题和gson-2.2.4.jar. 删除它对我有用. 总结
以上是内存溢出为你收集整理的android – Gson:由于ExclusionStrategy错误导致无法编译项目全部内容,希望文章能够帮你解决android – Gson:由于ExclusionStrategy错误导致无法编译项目所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)