gpt4 book ai didi

android - APK app-debug-unaligned.apk 打包过程中文件重复

转载 作者:IT王子 更新时间:2023-10-28 23:44:55 26 4
gpt4 key购买 nike

当放 2 个 jar 文件时,打包 APK app-debug-unaligned.apk 时出现此错误:

  • httpclient-4.3.5.jar

  • httpmime-4.3.5.jar

    Sync with GradleRun之后进入libs文件夹。

如果用户 1 jar 文件 - httpmime-4.3.5.jar,我不会得到这个错误。

请帮助我如何避免此错误并且仍然可以使用上面的 2 个 jar 文件,

谢谢,

p/s : 我使用的是 Android Studio 0.8.6 版。

错误详情

Error:duplicate files during packaging of APK ...\app\build\outputs\apk\app-debug-unaligned.apk Path in archive: META-INF/DEPENDENCIES Origin 1: ...\app\libs\httpclient-4.3.5.jar Origin 2: ...\app\libs\httpmime-4.3.5.jar

build.gradle

android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'com.app'
minSdkVersion 9
targetSdkVersion 20
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:20.0.0'
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.google.android.gms:play-services:5.2.08'
compile 'com.viewpagerindicator:library:2.4.1@aar'
compile 'de.hdodenhof:circleimageview:1.2.0'
compile files('libs/httpmime-4.3.5.jar')
}

UPDATE 我从 compile files('libs/httpmime-4.3.5.jar') 改为使用 Maven Link。将 2 个 maven 链接放在一起后,我又遇到了同样的错误:

    compile 'org.apache.httpcomponents:httpmime:4.4-alpha1'
compile 'org.apache.httpcomponents:httpcore:4.4-alpha1'

这是警告

Warning:Dependency org.apache.httpcomponents:httpclient:4.4-alpha1 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages

Warning:Dependency org.apache.httpcomponents:httpclient:4.4-alpha1 is ignored for release as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jar to change the class packages

请帮我解决。

SOULITION 我现在知道了很好的答案,通过添加这些行将修复 Duplicate files 错误:

packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}

最佳答案

您可以将 compile files('libs/httpmime-4.3.5.jar') 替换为此编译 'org.apache.httpcomponents:httpmime:4.3.5'

另外,您正在复制依赖项 compile fileTree(include: ['*.jar'], dir: 'libs') 已经包含 compile files('libs/httpmime-4.3. 5.jar')

关于android - APK app-debug-unaligned.apk 打包过程中文件重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25483410/

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