问题
What went wrong:
Execution failed for task ‘:app:transformClassesWithDexForDebug’.com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lorg/apache/commons/collections/Buffer;
Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.
原因: 有重复 jar 包
分析 build.gralid:
apply plugin: ‘com.android.application’
apply plugin: ‘android-apt’
android {
compileSdkVersion 25
buildToolsVersion ‘25.0.0’
/* 1. IM 集成需调用 http */
useLibrary ‘org.apache.http.legacy’
defaultConfig {
applicationId "com.taikanglife.isalessystem"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
//选择要添加的对应cpu类型的.so库。
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64', 'mips', 'mips64'
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
}
manifestPlaceholders = [
JPUSH_PKGNAME: applicationId,
JPUSH_APPKEY : "a6d4d20aa61934a5032101ee", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
/*IM 2. 的libs 依赖 jni */
sourceSets{
main{
jniLibs.srcDirs = ['libs']
}
}
}
dependencies {
compile fileTree(include: [‘*.jar’], dir: ‘libs’)
// //导入腾讯云直播SDK jar
// compile fileTree(dir: ‘src/main/jniLibs’, include: [‘*.jar’])
androidTestCompile(‘com.android.support.test.espresso:espresso-core:2.2.2’, {
exclude group: ‘com.android.support’, module: ‘support-annotations’
})
compile ‘com.jakewharton:butterknife:8.4.0’
apt ‘com.jakewharton:butterknife-compiler:8.4.0’
compile ‘com.android.support:appcompat-v7:25.3.1’
testCompile ‘junit:junit:4.12’
compile ‘com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+’
compile ‘io.reactivex:rxjava:1.2.9’
compile ‘io.reactivex:rxandroid:1.2.1’
compile ‘com.squareup.retrofit2:retrofit:2.2.0’
compile ‘com.squareup.retrofit2:converter-gson:2.2.0’
compile ‘com.squareup.retrofit2:converter-scalars:2.0.0’
compile ‘com.squareup.retrofit2:adapter-rxjava:2.2.0’
compile ‘com.squareup.okhttp3:logging-interceptor:3.7.0’
compile ‘com.nineoldandroids:library:2.4.0’
compile ‘com.github.bumptech.glide:glide:3.7.0’
compile ‘jp.wasabeef:glide-transformations:1.0.6’
compile ‘org.greenrobot:eventbus:3.0.0’
compile ‘cn.jiguang.sdk:jpush:3.0.5’
// 此处以JPush 3.0.5 版本为例。
compile ‘cn.jiguang.sdk:jcore:1.1.2’
// 此处以JCore 1.1.2 版本为例。
compile ‘com.android.support:recyclerview-v7:25.3.1’
compile ‘com.android.support:design:25.3.1’
compile ‘com.android.support:support-v4:25.3.1’
compile ‘commons-codec:commons-codec:20041127.091804’
compile “net.sf.json-lib:json-lib:2.2.1:jdk15”
/* IM 集成需调用 http */
compile files(‘libs/imsdk_group_ext.jar’)
compile files(‘libs/imsdk_msg_ext.jar’)
compile files(‘libs/imsdk_sns_ext.jar’)
/*Im,。。。。。。。*/
// compile files(‘src/main/jniLibs/txrtmpsdk.jar’)
}
分析: 可能重复为
compile “net.sf.json-lib:json-lib:2.2.1:jdk15”
注销后,测试,可以通过!