Android Studio 0.4 在 APK META-INF/LICENSE.txt 中复制的重复文件 [英] Android Studio 0.4 Duplicate files copied in APK META-INF/LICENSE.txt

查看:55
本文介绍了Android Studio 0.4 在 APK META-INF/LICENSE.txt 中复制的重复文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我将 Studio 从 0.3.7 更新到 0.4.0 后,我无法编译我的项目.我在 stackoverflow 上找到了一个解决方案:复制了重复文件(Android Studio 0.4.0)

After I have updated my Studio from 0.3.7 to 0.4.0, I can't compile my project. I found a solution on stackoverflow: Duplicate files copied (Android Studio 0.4.0)

我将我的项目更新为 gradle 0.7.+,但我不知道我必须把下一个字符串放在哪里:

I updated my project to gradle 0.7.+, but I don't know where I must put the next strings:

android {

    packagingOptions {
       exclude 'META-INF/LICENSE.txt'
    }
}

我的日志:日志

Execution failed for task ':Prog:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE.txt
    File 1: /home/scijoker/AndroidStudioProjects/ProgProject/Prog/libs/httpclient-4.1.1.jar
    File 2: /home/scijoker/AndroidStudioProjects/ProgProject/Prog/libs/httpclient-4.1.1.jar

附言在 ubuntu 13.04 中开发

P.S. Develop in ubuntu 13.04

推荐答案

将依赖放在顶部,将 packageOptions 放在最后对我有用.

Putting the dependecies at the top and the packageOptions at the end worked for me.

apply plugin: 'android'. 

这是我在 app 文件夹中的完整 build.gradle.

Here is my full build.gradle at the app folder.

dependencies {
    compile 'com.android.support:support-v4:+'
    compile files('libs/apache-mime4j-0.6.jar')
    compile files('libs/httpmime-4.0.jar')
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 10
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-    rules.txt'
    }


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

几乎所有的操作系​​统许可证都包含在您的项目中包含一份许可证副本"的义务.所以这意味着,您必须在项目中包含您使用的所有操作系统许可证的副本.通过在 gradle 中排除"它们,您违反了许可证.

Almost all OS licence include the obligation to "include a copy of the licence" into your project. So this means, that you have to include a copy of all OS licences you use into you projects. By "excluding" them in gradle, you violate the licences.

将他们排除在项目之外可能不是最佳选择.谢谢你.信息.

Excluding them from the project might not be the best option. Thank you R.S. for the info.

这篇关于Android Studio 0.4 在 APK META-INF/LICENSE.txt 中复制的重复文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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