【问题标题】:java.util.zip.ZipException: duplicate entry with spring frameworkjava.util.zip.ZipException:与弹簧框架重复条目
【发布时间】:2015-09-08 05:59:04
【问题描述】:

我正在 android studio 中使用 spring 框架开发 android 应用程序, 我有这个错误

Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: org/springframework/beans/BeansException.class

我阅读了一些问题/答案,但我没有找到解决问题的方法, 例子: java.util.zip.ZipException: duplicate entry during packageAllDebugClassesForMultiDex

我的 build.brandle 是

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.simone.oauth"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/notice.txt'
    }
}

configurations.compile {
    exclude module: 'spring-core'
    exclude module: 'spring-web'
    exclude module: 'commons-logging'

}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile ('com.android.support:appcompat-v7:22.2.0')
    compile ('org.springframework.android:spring-android-rest-template:1.0.1.RELEASE')
    compile 'org.springframework.android:spring-android-auth:1.0.1.RELEASE'
    compile 'org.springframework.security:spring-security-crypto:3.1.3.RELEASE'
    compile 'org.springframework.social:spring-social-config:1.1.0.RELEASE'
    compile 'org.springframework.social:spring-social-core:1.1.2.RELEASE'
    compile 'org.springframework.social:spring-social-google:1.0.0.RELEASE'
    compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.11'
}

如何排除此错误?

【问题讨论】:

    标签: android android-studio android-gradle-plugin android-multidex


    【解决方案1】:

    multidex spring-core 遇到了几乎相同的问题,我就是这样解决的

    compile ('org.springframework.security:spring-security-crypto:3.1.4.RELEASE')
            {
                exclude group :'org.springframework', module: 'spring-core'
            }
    

    所以在你的情况下你必须排除弹簧豆

    【讨论】:

      猜你喜欢
      • 2017-08-18
      • 1970-01-01
      • 1970-01-01
      • 2015-03-25
      • 1970-01-01
      • 2023-04-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多