当前位置 : 主页 > 手机开发 > android >

android – Gson:由于ExclusionStrategy错误导致无法编译项目

来源:互联网 收集:自由互联 发布时间:2021-06-11
我正在接管一个项目而且它没有编译.当我构建它时,我收到以下错误: Program type already present: com.google.gson.ExclusionStrategy 据我所见,我的项目中没有使用ExclusionStrategy.我真的不知道如何找
我正在接管一个项目而且它没有编译.当我构建它时,我收到以下错误:

Program type already present: com.google.gson.ExclusionStrategy

据我所见,我的项目中没有使用ExclusionStrategy.我真的不知道如何找到解决方案……

下面是完整的错误堆栈.

org.gradle.api.tasks.TaskExecutionException: Execution failed for
task
‘:sample-mpa-ui:transformDexArchiveWithExternalLibsDexMergerForMyProjectModelDebug’.
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\transforms\dexBuilder\MyProjectModel\debug\0.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\1.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\2.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\3.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\4.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\5.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\6.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\7.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\8.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\9.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\10.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\11.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\12.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\13.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\14.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\15.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\16.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\17.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\18.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\19.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\20.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\21.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\22.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\23.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\24.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\25.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\26.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\27.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\28.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\29.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\30.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\31.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\32.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\33.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\34.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\35.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\36.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\37.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\38.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\39.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\40.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\41.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\42.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\43.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\44.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\45.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\46.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\47.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\48.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\49.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\50.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\51.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\52.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\53.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\54.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\55.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\56.jar,
C:\Sources\MyProject\build\intermediates\transforms\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.TransformTask.transform(TransformTask.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\transforms\dexBuilder\MyProjectModel\debug\0.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\1.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\2.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\3.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\4.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\5.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\6.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\7.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\8.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\9.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\10.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\11.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\12.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\13.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\14.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\15.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\16.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\17.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\18.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\19.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\20.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\21.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\22.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\23.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\24.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\25.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\26.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\27.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\28.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\29.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\30.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\31.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\32.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\33.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\34.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\35.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\36.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\37.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\38.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\39.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\40.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\41.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\42.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\43.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\44.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\45.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\46.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\47.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\48.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\49.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\50.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\51.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\52.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\53.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\54.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\55.jar,
C:\Sources\MyProject\build\intermediates\transforms\dexBuilder\MyProjectModel\debug\56.jar,
C:\Sources\MyProject\build\intermediates\transforms\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.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:101)
at com.android.build.gradle.internal.transforms.ExternalLibsMergerTransform.transform(ExternalLibsMergerTransform.kt:123)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:221)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.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.1

android {
    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 GroovyAssignabilityCheck
dependencies {
    // 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. 删除它对我有用.
网友评论