当我使用这两个模块时,会出现以下异常:
compile ('com.android.support:support-compat:24.2.0')
compile ('com.android.support:support-core-utils:24.2.0')
例外:
Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
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:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
但是当我将上面的两个更改为 BIG 时,异常消失了!!!
compile ('com.android.support:support-v4:24.2.0')
这是我原来的build.gradle,我只是升级support-v4
dependencies {
compile 'com.android.support:support-v4:23.0.1'
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.squareup.okhttp:okhttp:2.7.5'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
任何人都知道为什么会发生这种情况以及如何解决这个问题?感谢。