问题描述
初次使用环信,在AndroidStudio中新建一空白项目,将easeUI以module的形式引入,构建没问题,单一运行重新构建时就报错:UNEXPECTED TOP-LEVEL EXCEPTION:com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)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) FAILEDFAILURE: Build failed with an exception.既然说重复引入了v4包,难道我要将easeUI的lib下的supportV4删除么?删了的话,easeUI直接报错,找不到相关v4资源;自己工程的build.gradle:apply plugin: 'com.android.application'android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "austin.com.huanxintest" minSdkVersion 14 targetSdkVersion 20 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }}dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' // compile 'com.android.support:appcompat-v7:23.2.1' compile 'com.android.support:design:23.2.1' compile project(':easeui')}easeUI的build.gradle:apply plugin: 'com.android.library'android { compileSdkVersion 19 buildToolsVersion "23.0.1" defaultConfig { minSdkVersion 9 targetSdkVersion 20 }sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] jniLibs.srcDirs = ['libs'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } }}dependencies {//release时需要把easemobchatsdk的依赖注释掉,sdk已经被打成jar包放在libs底下//compile project(':hyphenatechatsdk') compile fileTree(dir: 'libs', include: '*.jar')}另外,minifest.xml 和 BaseApplication已经按照文档做了集成修改。求环信各位大神指教,感激不尽。。。。
解决方案
何だ、だれもいませんね。
解决方案二:
easeui里有v4包,去掉你项目里的v4
解决方案三:
楼主,你这个问题解决了吗?我现在也遇到了