我有我的摇篮项目申报上的build.gradle我的依赖关系:Android的工作室+摇篮:java.lang.IllegalArgumentException异常
dependencies {
compile 'com.android.support:support-v4:18.0.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.android:spring-android-core:1.0.1.RELEASE'
compile 'org.roboguice:roboguice:2.0'
}
与摇篮建立正常工作,但是当运行我的项目出现以下错误是编译阶段:
Gradle: UNEXPECTED TOP-LEVEL EXCEPTION:
Gradle: java.lang.IllegalArgumentException: already added: Lorg/springframework/util/FileCopyUtils;
Gradle: at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
Gradle: at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
我使用Gradle 1.8。
非常感谢你,@scott,很好的答案和很好的解释。 – Joseph
'spring-android-core'是'spring-core'的一个分支子集,它已经针对Android进行了构建和测试。相比之下,Spring框架模块本身并没有在开发或测试Android时考虑到。对于单独的休息模板使用,一切运作顺利。然而,当使用Spring Social(以及Spring Security Crypto)时,我们需要确保排除任何支持'spring-android-core'和'spring-android-rest-template'的Spring框架依赖。 –
Spring for Android GitHub README现在包含一个[示例生成配置](https://github.com/spring-projects/spring-android#example-build-configuration)。希望这会帮助其他人看到这个线程。 –