在APK应用程序,调试unaligned.apk包装重复文件 [英] Duplicate files during packaging of APK app-debug-unaligned.apk

查看:239
本文介绍了在APK应用程序,调试unaligned.apk包装重复文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个错误在包装重复文件APK应用程序,调试unaligned.apk 时,把2 JAR文件:

  • HttpClient的-4.3.5.jar

  • httpmime-4.3.5.jar

    文件夹同步与摇篮运行

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

请帮助我如何避免这种错误和放大器;仍然可以使用2 jar文件在上面还,

谢谢

P / S:我采用Android Studio的0.8.6版本

错误详细信息

  

错误:在APK包装重复的文件   ... \程序\编译\输出\ APK \ APP-调试unaligned.apk       路径在归档:META-INF / DEPENDENCIES       原产地1:... \程序\库\ HttpClient的-4.3.5.jar       原产地2:... \程序\库\ httpmime-4.3.5.jar

build.gradle

 安卓{
compileSdkVersion 20
buildToolsVersion '20 .0.0
defaultConfig {
    的applicationIDcom.app
    的minSdkVersion 9
    targetSdkVersion 20
    版本code 1
    VERSIONNAME'1.0'
}
buildTypes {
    推出 {
        runProguard假
        proguardFiles getDefaultProguardFile('ProGuard的-android.txt'),'proguard-rules.pro
    }
}
productFlavors {
}
packagingOptions {
    不包括META-INF / LICENSE.TXT
}

依赖{
编译文件树(包括:['的* .jar'],DIR:库)
编译com.android.support:support-v4:20.0.0
编译com.android.support:appcompat-v7:20.0.0
编译com.google.android.gms:播放服务:08年5月2日
编译com.viewpagerindicator:库:2.4.1@aar
编译de.hdodenhof:circleimageview:1.2.0
编译文件(库/ httpmime-4.3.5.jar)
}
 

更新我从编译文件(库/ httpmime-4.3.5.jar)改为来使用Maven的链接。我再次得到了同样的错误后,把2行家联系在了一起:

 编译org.apache.httpcomponents:httpmime:4.4 ALPHA1
编译org.apache.httpcomponents:的HttpCore:4.4 ALPHA1
 

这是警告

  

警告:依赖org.apache.httpcomponents:HttpClient的:4.4-α1是   忽略调试,因为它可与内部版本冲突的   搭载Android提供的。            如遇问题,请及时与jarjar重新包装更改类包

     

警告:依赖   org.apache.httpcomponents:HttpClient的:4.4-α1被忽略发布   因为它可能是相互冲突的与所提供的内部版本   Android系统。            如遇问题,请及时与瓶子重新包装更改类包

请帮我解决。

SOULITION 我知道好的答案现在addding这些线路将修复复制文件错误:

  packagingOptions {
    不包括META-INF / DEPENDENCIES.txt
    不包括META-INF / LICENSE.TXT
    不包括META-INF / NOTICE.txt
    不包括META-INF /注意事项
    不包括META-INF /许可证
    不包括META-INF / DEPENDENCIES
    不包括META-INF / notice.txt
    不包括META-INF / LICENSE.TXT
    不包括META-INF / dependencies.txt
    不包括META-INF / LGPL2.1
}
 

解决方案

您可以替换编译文件(库/ httpmime-4.3.5.jar')本编译'org.apache.httpcomponents:httpmime:4.3.5

另外要复制的依赖编译文件树(包括:['的* .jar'],DIR:'库')已经包含了编译文件(库/ httpmime-4.3.5.jar')

I got this error Duplicate files during packaging of APK app-debug-unaligned.apk when put 2 jar files :

  • httpclient-4.3.5.jar

  • httpmime-4.3.5.jar

    into the libs folder after Sync with Gradle and Run.

If user 1 jar file - httpmime-4.3.5.jar, I will not get this error.

Please help me how to avoid this error & still can use 2 jar files in above also,

Thanks,

p/s : I use Android Studio version 0.8.6.

Error Detail

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 I changed from compile files('libs/httpmime-4.3.5.jar') to use Maven Link. I got same error again after put 2 maven link together:

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

This is the warning

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

Please help me fix.

SOULITION I know good answer now by addding these lines will fix Duplicate files error :

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'
}

解决方案

You can replace compile files('libs/httpmime-4.3.5.jar') with this compile 'org.apache.httpcomponents:httpmime:4.3.5'.

Also you are duplicating the dependencies compile fileTree(include: ['*.jar'], dir: 'libs') already includes compile files('libs/httpmime-4.3.5.jar')

这篇关于在APK应用程序,调试unaligned.apk包装重复文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆