java.util.zip.ZipException:重复条目:android/support/v7/view/ActionMode$Callback.class

java.util.zip.ZipException: duplicate entry: android/support/v7/view/ActionMode$Callback.class

我在我的 Android 工作室中导入了一个项目,所以我的 build.gradle 文件如下。

build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.pkg.name"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
   }
 }

dependencies {
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/gson-2.1.jar')
compile files('libs/httpmime-4.0.1.jar')
compile files('libs/itextpdf-5.1.0.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/opencsv-2.4.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/ormlite-core-4.48.jar')
compile files('libs/google-play-services.jar')
compile files('libs/android-support-v7-appcompat.jar')
compile 'com.android.support:appcompat-v7:22.2.0'
}

当我 运行 我的项目时,它给我如下错误:

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v7/view/ActionMode$Callback.class

知道如何解决这个问题吗?您的所有建议都很可取。

您两次包含 appcompat 库:

compile files('libs/android-support-v7-appcompat.jar')
compile 'com.android.support:appcompat-v7:22.2.0'

另请注意,您还需要为 multidex 支持进行一些其他调整:https://developer.android.com/tools/building/multidex.html