app_downloadfile:transformResourcesWithMergeJavaResForDebug

来源:互联网 发布:星际争霸数据 编辑:程序博客网 时间:2024/05/16 17:46

其实我在导包过程中,不光遇到了上篇博文的问题,还遇到了,这个错误

Error:Execution failed for task ':app_downloadfile:transformResourcesWithMergeJavaResForDebug'.> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE.txt    File1: E:\AndroidStudioProjects\My_Application2\app_downloadfile\src\main\res\httpclient-4.2.5.jar    File2: E:\AndroidStudioProjects\My_Application2\app_downloadfile\src\main\res\httpcore-4.2.4.jar

其中httpclient-4.2.5.jar,httpcore-4.2.4.jar是我导入的两个jar包,然后百度得到了一段祖传代码,因为我也不知道有什么作用,看起来和我加入的jar包并没有什么关系!答主叫我加在对应Module的build.gradle里面,就像这样:

apply plugin: 'com.android.application'android {    compileSdkVersion 23    buildToolsVersion "23.0.2"    defaultConfig {        applicationId "com.example.yuxin.app_downloadfile"        minSdkVersion 15        targetSdkVersion 23        versionCode 1        versionName "1.0"    }    buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }    }}//android{////    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'//    }//}dependencies {    compile fileTree(include: ['*.jar'], dir: 'libs')    testCompile 'junit:junit:4.12'    compile 'com.android.support:appcompat-v7:23.1.1'    compile files('src/main/res/httpcore-4.2.4.jar')    compile files('src/main/res/httpclient-4.2.5.jar')}

其中注释的那段代码就是获得的祖传代码。
好了,问题解决了!我爱这个世界。

我的博客网站:http://huyuxin.top/欢迎大家访问!评论!

0 0
原创粉丝点击