我在android studio中开发应用程序。当我在设备中运行我的应用时,出现.dex file cannot exceed 64k
错误。为此,我在build.gradle文件中使用multiDexEnabled true
。现在我没有收到这个错误,但我得到了
Error:Execution failed for task ':MyApp:transformClassesWithJarMergingForDebug'
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / support / annotation / ColorRes.class`
有任何帮助来解决这个问题吗?这是我的build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.mouthshut"
minSdkVersion 14
targetSdkVersion 23
useLibrary 'org.apache.http.legacy'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
multiDexEnabled true
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.txt'
}
}
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
dependencies {
compile project(':comnostra13exampleuniversalimageloaderHomeActivity')
compile project(':nineoldandroid')
compile project(':libraryActionbar')
compile project(':pullToRefresh')
compile project(':facebook')
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:19.1.0'
compile files('libs/AF-Android-SDK-v2.3.1.19.jar')
compile files('libs/classes.jar')
compile files('libs/CleverTapAndroidSDK-v1-20150903.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
//compile 'com.github.adrian110288:LoadIndicators:83ce610325'
compile project(':LoadIndicatorLibrary')
//compile 'com.squareup.picasso:picasso:2.5.2'
}