关闭

关于导入jar时出现的问题

233人阅读 评论(0) 收藏 举报

提示信息如下:

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. > com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE.txt

File1: E:\androidworkspace\yiyuangou\app\libs\commons-codec-1.4.jar

File2: E:\androidworkspace\yiyuangou\app\libs\httpcore-4.2.4.jar


只需在项目工程app下写入一下代码

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

完整实例:
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

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

    defaultConfig {
        applicationId "com.example.lxy.yiyuangou"
        minSdkVersion 11
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:design:23.2.1'
    compile files('libs/universal-image-loader-1.9.2.jar')
    compile files('libs/gson-2.3.1.jar')
    compile files('libs/android-async-http-1.4.4.jar')
    compile 'com.google.android.gms:play-services-appindexing:8.1.0'
    compile files('libs/commons-codec-1.4.jar')
    compile files('libs/okhttp-2.3.0.jar')
    compile 'com.squareup.okio:okio:1.5.0'
    compile files('libs/securepay_stand_2.4.6.jar')

}

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:30861次
    • 积分:783
    • 等级:
    • 排名:千里之外
    • 原创:42篇
    • 转载:12篇
    • 译文:1篇
    • 评论:22条
    文章分类
    最新评论