gpt4 book ai didi

android - Prograurd 重复的 zip 条目

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:49:14 25 4
gpt4 key购买 nike

我在签署和发布 APK 时遇到问题。我收到重复的 zip 条目警告和一个错误,这是代码:

Information:Gradle tasks [:app:assembleRelease]
Warning:can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [gcm.jar:META-INF/MANIFEST.MF])
Warning:can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [gson-2.2.4.jar:META-INF/MANIFEST.MF])
Warning:can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [httpmime-4.2.2.jar:META-INF/MANIFEST.MF])
Warning:can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [joda-time-2.1.jar:META-INF/MANIFEST.MF])
Warning:can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [joda-time-2.1.jar:META-INF/LICENSE.txt])
Warning:can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [joda-time-2.1.jar:META-INF/NOTICE.txt])
Warning:can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [splunk-mint-4.2.1.jar:META-INF/MANIFEST.MF])
Warning:can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [universal-image-loader-1.9.4.jar:META-INF/MANIFEST.MF])
Warning:can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning:can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [support-annotations-24.0.0.jar:META-INF/MANIFEST.MF])
Warning:can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Error:Execution failed for task ':app:transformClassesWithMultidexlistForRelease'.
> java.io.IOException: Can't write [D:\Android\Android_Project\myapp\app\build\intermediates\multi-dex\release\componentClasses.jar] (Can't read [C:\Users\Amir Mahmoud\.android\build-cache\3936c6cf75e73634f829890fcc2030092ab8dabe\output\jars\classes.jar] (Duplicate zip entry [classes.jar:android/support/v4/view/ViewCompat$ICSViewCompatImpl.class]))

我什至尝试向 gradle 添加打包选项,但它不起作用这是我的 gradle 代码:

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.company.myapp"
minSdkVersion 14
targetSdkVersion 21
versionCode 70
versionName "7.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// compile 'com.android.support:appcompat-v4:25'
testCompile 'junit:junit:4.12'
// compile fileTree(include: '*.jar', dir: 'libs')
compile 'com.google.android.gms:play-services:10.2.1'
// compile "com.google.android.gms:play-services-gcm:10.2.1"
// compile 'org.apache.httpcomponents:httpmime:4.5.3'
// compile files('libs/gson-2.2.4.jar')
// compile files('libs/httpmime-4.2.2.jar')
// compile files('libs/joda-time-2.1.jar')
// compile files('libs/universal-image-loader-1.9.4.jar')
// compile files('libs/android-support-v4.jar')

}

我在这个项目上呆了几天,我不知道该怎么办,欢迎任何帮助。

最佳答案

除了 Jared 的回答之外,如果您收到有关重复 .class 文件的错误,而不仅仅是 META-INF/ 文件,您可能需要排除包含重复的 .class 文件的有问题的模块。

您需要确定哪个依赖项包含具有重复 .class 条目的模块,并从所述依赖项中排除该模块。

您可以使用 Gradle 命令:./gradlew app:dependencies 列出完整的依赖关系图。其中“app:”是您项目的模块/应用程序的名称。

使用 ./gradlew app:dependencies 命令后,您应该查看依赖项列表并找到包含具有重复 .class 的违规模块的那个条目。

例如,假设 com.android.support:support-v4 是包含导致这些错误的重复类的模块。以下是如何从您的依赖项中排除该重复模块:

//Your dependency that includes the module with the duplicates.
compile('com.my.project:my-module:0.1') {
//exclude the offending module so there won’t be duplicates.
exclude module: 'support-v4'
//maybe you need to exclude a group also?...
exclude group: 'com.google.android.gms'
}

关于android - Prograurd 重复的 zip 条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43496103/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com