【问题标题】:java.util.zip.ZipException: duplicate entry: android/support/v7/view/ActionMode$Callback.classjava.util.zip.ZipException:重复条目:android/support/v7/view/ActionMode$Callback.class
【发布时间】:2015-07-20 09:04:05
【问题描述】:

我在我的 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

知道如何解决这个问题吗?您的所有建议都是值得赞赏的。

【问题讨论】:

  • 为什么你添加了两次android-support-v7-appcompat?。删除任何一个
  • MD:是的,你是对的?

标签: android android-gradle-plugin executable-jar


【解决方案1】:

您包含 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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-02-09
  • 2015-09-05
  • 1970-01-01
  • 1970-01-01
  • 2017-08-18
相关资源
最近更新 更多