我将Digits mobile sdk集成到我的项目中,它不再构建。它与我正在使用的gson库有某种冲突。我在构建期间遇到此错误:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/gson/Gson$5.class
这是我的build.gradle
buildscript {
repositories {maven { url 'https://maven.fabric.io/public' }}
dependencies {classpath 'io.fabric.tools:gradle:1.+'}}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {...}
buildTypes {release {...}}
dexOptions {preDexLibraries = false
incremental true
javaMaxHeapSize "4g"}
packagingOptions {...}}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }}
dependencies {
...
compile('com.crashlytics.sdk.android:crashlytics:2.2.4@aar') {
transitive = true;}
compile 'io.branch.sdk.android:library:1.5.5'
compile('com.digits.sdk.android:digits:1.5.0@aar') {
transitive = true;}}
答案 0 :(得分:6)
这是解决方案
compile('com.digits.sdk.android:digits:1.5.0@aar') {
transitive = true;
exclude module: 'gson';
}
您需要添加排除模块:' gson'