导入项目到 eclipse 从 android 得到错误的studio

发布时间: 2016/9/26 4:35:18
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.

我是新来的 Android studio,我只是导入的项目 Android studio,在 Eclipse 中运行。很少有错误得到解决,但这尚未解决。

这里是错误-

错误︰ 执行失败的任务 ':app:transformResourcesWithMergeJavaResForDebug'。 com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException︰ 重复复制在 APK 元-INF/LICENSE.txt File1 文件︰ /home/user86/Downloads/IAH/app/libs/httpmime-4.2.3.jar 文件 2: /home/user86/Downloads/IAH/app/libs/httpclient-4.2.3.jar 作品 3: /home/user86/Downloads/IAH/app/libs/httpcore-4.2.2.jar

在这里是 build.gradle 文件代码。

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.packagename"
    minSdkVersion 14
    targetSdkVersion 23
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }
}}


dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.android.gms:play-services:+'
compile files('libs/Parse-1.4.0.jar')
compile files('libs/httpclient-4.2.3.jar')
compile files('libs/httpcore-4.2.2.jar')
compile files('libs/httpmime-4.2.3.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/volley.jar')
}

有助于问题的解决。在此先感谢。

更新的 gradle 文件

apply plugin: 'com.android.application'


dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.android.gms:play-services:+'
compile files('libs/Parse-1.4.0.jar')
compile files('libs/httpclient-4.2.3.jar')
compile files('libs/httpcore-4.2.2.jar')
compile files('libs/httpmime-4.2.3.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/volley.jar')}



android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.instantassignmenthelp"
    minSdkVersion 14
    targetSdkVersion 23
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.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'}

解决方法 1:

PackageOptions 应该进屋来 android tag

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.instantassignmenthelp"
    minSdkVersion 14
    targetSdkVersion 23
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.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'
    }
}
官方微信
官方QQ群
31647020