【发布时间】:2016-02-08 09:09:55
【问题描述】:
我是 Android Studio 的新手,我只是在 Android Studio 中导入了一个在 Eclipse 中运行的项目。解决了一些错误,但这还没有解决。
这是错误 -
错误:任务 ':app:transformResourcesWithMergeJavaResForDebug' 执行失败。 com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:在 APK META-INF/LICENSE.txt 中复制的文件重复 文件 1:/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'}
【问题讨论】:
-
做了同样的事,但没有工作。
-
你可以发布你修改过的gradle文件吗?
-
评论
compile files('libs/httpclient-4.2.3.jar')stackoverflow.com/questions/20673625/… -
@IntelliJAmiya - 不工作。
标签: android android-studio build.gradle