Android-错误:程序类型已存在:com.google.gsonhtcfix.Gson$5

Android-错误:程序类型已存在:com.google.gsonhtcfix.Gson$5,android,Android,我在运行已存在的项目程序类型时遇到此错误:com.google.gsonhtcfix.Gson$5 有什么解决办法吗 StackOverflow中的其他答案说添加了这段代码,但它对我不起作用 configurations { all*.exclude group: 'com.google.code.gson' } build.gradle dependencies { implementation fileTree(include: ['*.ja

我在运行已存在的项目程序类型时遇到此错误:com.google.gsonhtcfix.Gson$5

有什么解决办法吗

StackOverflow中的其他答案说添加了这段代码,但它对我不起作用

configurations {
            all*.exclude group: 'com.google.code.gson'
        }
build.gradle

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-media-compat:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation project(':abc')
    'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation project(':xyz')

    configurations {
        all*.exclude group: 'com.google.code.gson'
    }

    configurations.all {
        resolutionStrategy {
            eachDependency {
                DependencyResolveDetails details ->
                    if (details.requested.group == 'com.myapp.nm') {
                        details.useVersion "1.0.2"
                    }
                    if (details.requested.group == 'com.myapp.utility') {
                        details.useVersion "1.0.1"
                    }
            }
        }
    }
}

也许版本很重要?为什么要排除gson这个
build.gradle
是无效的,这些包甚至不依赖于
com.google.code.gson
。副本来自
:abc
:xyz
…可能版本很重要?为什么要排除gson这个
build.gradle
是无效的,这些包甚至不依赖于
com.google.code.gson
。副本来自
:abc
:xyz
。。。