我使用android studio使用最新的Tyrus构建使用websockets创建一个Android应用程序。我已经通过gradle包含了库,就像build.gradle
一样dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'org.glassfish.tyrus.bundles:tyrus-standalone-client:1.10'
}
使用android目标版本
minSdkVersion 15
targetSdkVersion 21
每次运行编译按钮时都会出现以下错误
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/root/Android/Sdk/build-tools/21.1.2/dx --dex --no-optimize --output /home/dorian/AndroidStudioProjects/MyApplication/app/build/intermediates/dex/debug --input-list=/home/dorian/AndroidStudioProjects/MyApplication/app/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lorg/glassfish/tyrus/client/ClientManager$1$1;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
我的申请基于以下示例