If I run gradle assembleDebug
from the command line, I am suddenly getting this error:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.util.DexEx
A similar dex issue resolved method
gradle.build was containing:
compile files('libs/httpclient-4.2.1.jar')
compile 'org.apache.httpcomponents:httpclient:4.5'
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
The issue was resolved when i removed
compile files('libs/httpclient-4.2.1.jar')
My gradle now looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.mmm.ll"
minSdkVersion 16
targetSdkVersion 24
useLibrary 'org.apache.http.legacy'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.google.android.gms:play-services:6.1.+'
compile files('libs/PayPalAndroidSDK.jar')
compile files('libs/ksoap2-android-assembly-3.0.0-RC.4-jar-with-dependencies.jar')
compile files('libs/picasso-2.1.1.jar')
compile files('libs/gcm.jar')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
}
There was a redundancy in the JAR file and the compiled gradle project
So keenly look for dependency and jar files having same classes.
And remove redundancy.
This worked for me.