rest - Multiple dex files define Lorg/springframework/http/ContentCodingType$1 -
i test androidannotations framework, have error when add spring-android libs. create repo test project open_git_repo !
at moment, have in gradle console
agpbi: {"kind":"simple","text":"unexpected top-level exception:","position": {},"original":"unexpected top-level exception:"} agpbi: {"kind":"simple","text":"com.android.dex.dexexception: multiple dex files define lorg/springframework/http/contentcodingtype$1;","position{},"original":"com.android.dex.dexexception: multiple dex files define lorg/springframework/http/contentcodingtype$1;"} agpbi: {"kind":"simple","text":"\tat com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:594)","position":{},"original":"\tat com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:594)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.merge.dexmerger.getsortedtypes(dexmerger.java:552)","position":{},"original":"\tat com.android.dx.merge.dexmerger.getsortedtypes(dexmerger.java:552)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.merge.dexmerger.mergeclassdefs(dexmerger.java:533)","position":{},"original":"\tat com.android.dx.merge.dexmerger.mergeclassdefs(dexmerger.java:533)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.merge.dexmerger.mergedexes(dexmerger.java:170)","position":{},"original":"\tat com.android.dx.merge.dexmerger.mergedexes(dexmerger.java:170)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.merge.dexmerger.merge(dexmerger.java:188)","position":{},"original":"\tat com.android.dx.merge.dexmerger.merge(dexmerger.java:188)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.command.dexer.main.mergelibrarydexbuffers(main.java:439)","position":{},"original":"\tat com.android.dx.command.dexer.main.mergelibrarydexbuffers(main.java:439)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.command.dexer.main.runmonodex(main.java:287)","position":{},"original":"\tat com.android.dx.command.dexer.main.runmonodex(main.java:287)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.command.dexer.main.run(main.java:230)","position":{},"original":"\tat com.android.dx.command.dexer.main.run(main.java:230)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.command.dexer.main.main(main.java:199)","position":{},"original":"\tat com.android.dx.command.dexer.main.main(main.java:199)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.command.main.main(main.java:103)","position":{},"original":"\tat com.android.dx.command.main.main(main.java:103)"} agpbi: {"kind":"simple","text":"unexpected top-level exception:","position":{},"original":"unexpected top-level exception:"} agpbi: {"kind":"simple","text":"com.android.dex.dexexception: multiple dex files define lorg/springframework/http/contentcodingtype$1;","position":{},"original":"com.android.dex.dexexception: multiple dex files define lorg/springframework/http/contentcodingtype$1;"} agpbi: {"kind":"simple","text":"\tat com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:594)","position":{},"original":"\tat com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:594)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.merge.dexmerger.getsortedtypes(dexmerger.java:552)","position":{},"original":"\tat com.android.dx.merge.dexmerger.getsortedtypes(dexmerger.java:552)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.merge.dexmerger.mergeclassdefs(dexmerger.java:533)","position":{},"original":"\tat com.android.dx.merge.dexmerger.mergeclassdefs(dexmerger.java:533)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.merge.dexmerger.mergedexes(dexmerger.java:170)","position":{},"original":"\tat com.android.dx.merge.dexmerger.mergedexes(dexmerger.java:170)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.merge.dexmerger.merge(dexmerger.java:188)","position":{},"original":"\tat com.android.dx.merge.dexmerger.merge(dexmerger.java:188)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.command.dexer.main.mergelibrarydexbuffers(main.java:439)","position":{},"original":"\tat com.android.dx.command.dexer.main.mergelibrarydexbuffers(main.java:439)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.command.dexer.main.runmonodex(main.java:287)","position":{},"original":"\tat com.android.dx.command.dexer.main.runmonodex(main.java:287)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.command.dexer.main.run(main.java:230)","position":{},"original":"\tat com.android.dx.command.dexer.main.run(main.java:230)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.command.dexer.main.main(main.java:199)","position":{},"original":"\tat com.android.dx.command.dexer.main.main(main.java:199)"} agpbi: {"kind":"simple","text":"\tat com.android.dx.command.main.main(main.java:103)","position":{},"original":"\tat com.android.dx.command.main.main(main.java:103)"} failed failure: build failed exception. * went wrong: execution failed task ':app:dexdebug'. > com.android.ide.common.process.processexception:org.gradle.process.internal.execexception: process 'command 'c:\program files\java\jdk1.6.0_45\bin\java.exe'' finished non-zero exit value 2 * try: run --stacktrace option stack trace. run --info or --debug option more log output.
my build gradle script
buildscript { repositories { maven { url 'http://repo.spring.io/milestone' } jcenter() } dependencies { classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'} } apply plugin: 'com.android.application' android { compilesdkversion 19 buildtoolsversion "20.0.0" defaultconfig { applicationid "com.example.mbykov.myapplication" minsdkversion 15 targetsdkversion 15 versioncode 1 versionname "1.0" } apply plugin: 'com.android.application' apply plugin: 'android-apt' def aaversion = '3.3' dependencies { apt "org.androidannotations:androidannotations:3.3" compile "org.androidannotations:androidannotations-api:3.3" } apt { arguments { androidmanifestfile variant.outputs[0].processresources.manifestfile } } sourcesets {} packagingoptions { exclude 'meta-inf/dependencies.txt' exclude 'meta-inf/dependencies' exclude 'meta-inf/dependencies.txt' exclude 'meta-inf/license.txt' exclude 'meta-inf/license' exclude 'meta-inf/license.txt' exclude 'meta-inf/lgpl2.1' exclude 'meta-inf/notice.txt' exclude 'meta-inf/notice' exclude 'meta-inf/notice.txt' } } dependencies { compile filetree(include: ['*.jar'], dir: 'libs') //compile 'org.springframework.android:spring-android-rest-template:2.0.0.build-snapshot' compile 'org.springframework.android:spring-android-rest- template:1.0.1.release' } repositories { maven { url 'http://repo.spring.io/snapshot' }}
i don't understand error, explain going on?
two things:
first, declared dependencies:
//compile 'org.springframework.android:spring-android-rest-template:2.0.0.build-snapshot' compile 'org.springframework.android:spring-android-rest- template:1.0.1.release
i know commented out first dependency, make sure not have 2 @ time. cause duplicate classes in classpath , dex fails.
secondly, have spring android rest template jar in libs folder. cause duplicate, since referring library dependency repository, , dependency local libs folder. delete libs folder, totally unnecessary. should use proper dependency management, e.g. declare them in buildscript , let gradle download them transitive dependencies, correct version , dependency conflict resolution etc. remove line, too:
compile filetree(include: ['*.jar'], dir: 'libs')
Comments
Post a Comment