我是Android Studio新手,我只是在Eclipse中运行的Android Studio中导入一个项目。很少有错误得到解决,但目前尚未解决。
这是错误 -
错误:任务':app:transformResourcesWithMergeJavaResForDebug'执行失败。 com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:在APK META-INF / LICENSE.txt中复制的重复文件 File1:/home/user86/Downloads/IAH/app/libs/httpmime-4.2.3.jar File2:/home/user86/Downloads/IAH/app/libs/httpclient-4.2.3.jar File3:/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'}
答案 0 :(得分:1)
<强>建议强>
避免致电+
。
<强>不强>
compile 'com.google.android.gms:play-services:+'
<强>不要强>
compile 'com.google.android.gms:play-services:7.8.0' // Or latest stable version
<强>最后强>
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 :(得分:0)
尝试这样做,可以解决您的问题
如果您使用的是compile files('libs/volley.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')
答案 2 :(得分:0)
packageOptions应该在android标签内。
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'
}
}