[英]Android Studio Gradle error “Multiple dex files define…”
My Project was working fine, until I added the volley library. 我的项目运行良好,直到添加了凌空库。 Then, it started giving me an error like this: 然后,它开始给我这样的错误:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.> java.util.zip.ZipException: duplicate entry: com/android/volley/AuthFailureError.class 错误:任务':app:packageAllDebugClassesForMultiDex'的执行失败。> java.util.zip.ZipException:重复项:com / android / volley / AuthFailureError.class
What should I do to fix this error? 我该怎么办才能解决此错误?
My App gradle is below 我的App gradle在下面
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.snsepro.mym"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
ext {
supportLibVersion = '23.1.1' // variable that can be referenced to keep support libs consistent
}
repositories {
maven { url 'https://zendesk.artifactoryonline.com/zendesk/repo' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gcm.jar')
compile files('libs/gcm-src.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/jsoup-1.7.3.jar')
compile files('libs/gson-2.2.4.jar')
compile files('libs/volley.jar')
compile files('libs/cometchat-sdk.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.prolificinteractive:material-calendarview:0.7.0'
compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.2.9@aar'
compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.isseiaoki:simplecropview:1.0.8'
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile('com.zopim.android:sdk:1.1.1') {
exclude group: 'com.squareup.picasso'
}
}
And here is volley library added bulild.gradle 这是添加了bulild.gradle的排球库
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.snsepro.mym"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
ext {
supportLibVersion = '23.1.1' // variable that can be referenced to keep support libs consistent
}
repositories {
maven { url 'https://zendesk.artifactoryonline.com/zendesk/repo' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gcm.jar')
compile files('libs/gcm-src.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/jsoup-1.7.3.jar')
compile files('libs/gson-2.2.4.jar')
compile files('libs/volley.jar')
compile files('libs/cometchat-sdk.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.prolificinteractive:material-calendarview:0.7.0'
compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.2.9@aar'
compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.isseiaoki:simplecropview:1.0.8'
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile('com.zopim.android:sdk:1.1.1') {
exclude group: 'com.squareup.picasso'
}
compile 'com.mcxiaoke.volley:library-aar:1.0.1'
}
What library is your compile files('libs/volley.jar') If it is the same one , you will definitely get this error. 哪个库是您的编译文件('libs / volley.jar')如果相同,则肯定会出现此错误。 Try removing either one in that case. 在这种情况下,请尝试将其中任何一个卸下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.