Demo的下载地址: http://www.easemob.com/download
整个项目只用导入EaseUI就可以了,不要再在你的项目中导入SDK中的libs里面的jar包和jin文件了,因为EaseUI里面已经包含得有了。具体方式为:先下好EaseUI,在创建好的项目中File->New->import Module->你的EaseUI路径->finished
1.导入examples的ChatDemoUI3.0,如果没有关联类库easeui 的话要导入easeui类库并关联
运行时会出现以下异常
Error:Execution failed for task ':transformClassesWithJarMergingForDebug'.
> com.Android.build.api.transform.TransformException: Java.util.zip.ZipException: duplicate entry: android/support/annotation/ColorRes.class
这时在app的 build.gradle中添加
android{
......
configurations { all*.exclude group: 'com.android.support', module: 'support-v4' }
}
2.出现下面异常
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Program Files\Java\jdk1.8.0_92\bin\java.exe'' finished with non-zero exit value 2
在build.gradle添加
defaultConfig {
.......
multiDexEnabled true
}
3.报jar包冲突的错(v4.jar) 这里我是 我的项目用了v4jar,easeUI也有
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/annotation/ColorRes.class
解决方法:把app工程引用的v4.jar删掉,换成v7.jar (在app的 build.gradle文件的dependencies{ compile 'com.android.support:appcompat-v7:23+'} 此处还要特别注意compileSdkVersion 23
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.yinxin.app"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
要与v7.jar一致,不然会报Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\tools\SDK\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1 类似的错
)
出现找不到类的情况
必须把android-support-multidex.jar导到工程的libs去,并在在app的 build.gradle文件的dependencies{ compile fileTree(include: ['*.jar'], dir: 'libs', exclude: 'android-support-multidex.jar')
}