安卓:错误:执行失败的任务“:应用程序:transformClassesWithJarMergingForFlavorDebug”
问题描述:
嗨现在面临以下错误Android Studio中..安卓:错误:执行失败的任务“:应用程序:transformClassesWithJarMergingForFlavorDebug”
Error:Execution failed for task
':app:transformClassesWithJarMergingForFlavorDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/zxing/aztec/AztecDetectorResult.class
项目工作正常,但我不知道为什么它开始给这个例外。我并没有改变在gradle这个文件做任何事..
gradle这个文件:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'Project'
keyPassword 'password'
storeFile file('./../project/project.keystore')
storePassword 'password'
}
}
compileSdkVersion 25
buildToolsVersion '25.0.2'
useLibrary 'org.apache.http.legacy'
lintOptions {
checkReleaseBuilds false
}
dexOptions {
jumboMode = true
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.project.project"
minSdkVersion 15
targetSdkVersion 25
versionCode 38
versionName "2.1.0"
multiDexEnabled true
signingConfig signingConfigs.config
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
signingConfig signingConfigs.config
}
}
productFlavors {
flavor {
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/AndroidSwipeLayout-v1.1.8.jar')
compile files('libs/commons-codec-1.3.jar')
compile files('libs/httpmime-4.3.5.jar')
compile files('libs/linkedin-j-android.jar')
compile files('libs/localytics.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/retrofit-1.9.0.jar')
compile files('libs/twitter4j-core-4.0.1.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/zxing-2.1.jar')
compile files('libs/bolts-android-1.1.2.jar')
compile('com.facebook.android:facebook-android-sdk:[4,5)') {
exclude module: 'bolts-android'
exclude module: 'com.android.support:support-v4:23.0.3'
}
// compile 'com.kbeanie:image-chooser-library:[email protected]'
// compile 'com.kbeanie:image-chooser-library:[email protected]'
compile files('libs/isoparser-1.0-RC-27.jar')
compile files('libs/aspectjrt-1.8.7.jar')
compile project(':image-chooser-library')
compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.android.gms:play-services-plus:10.2.1'
compile 'com.appsflyer:af-android-sdk:[email protected]'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'javax.media:jmf:2.1.1e'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
我使用;
Windows 8.1 pro, Android Studio 2.3.3
我到目前为止试过的;
6405205毫无效果
可以请人帮助我。如果需要的任何其他信息,请让我知道
更新的信息: 在仿真器工作不改变任何东西,但不是我的手机即使它正在处理它也
答
尝试将此添加到您的应用程序的build.gradle
依赖关系:
compile('com.google.zxing:core:2.1') {
exclude group: 'com.google.zxing'
}
并删除这一行:
compile files('libs/zxing-2.1.jar')
答
If you are not using flavours then just remove the flavour section in gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'Project'
keyPassword 'password'
storeFile file('./../project/project.keystore')
storePassword 'password'
}
}
compileSdkVersion 25
buildToolsVersion '25.0.2'
useLibrary 'org.apache.http.legacy'
lintOptions {
checkReleaseBuilds false
}
dexOptions {
jumboMode = true
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.project.project"
minSdkVersion 15
targetSdkVersion 25
versionCode 38
versionName "2.1.0"
multiDexEnabled true
signingConfig signingConfigs.config
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
signingConfig signingConfigs.config
}
}
// comenting the flavour section
// productFlavors {
// flavor {
// }
// }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/AndroidSwipeLayout-v1.1.8.jar')
compile files('libs/commons-codec-1.3.jar')
compile files('libs/httpmime-4.3.5.jar')
compile files('libs/linkedin-j-android.jar')
compile files('libs/localytics.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/retrofit-1.9.0.jar')
compile files('libs/twitter4j-core-4.0.1.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/zxing-2.1.jar')
compile files('libs/bolts-android-1.1.2.jar')
compile('com.facebook.android:facebook-android-sdk:[4,5)') {
exclude module: 'bolts-android'
exclude module: 'com.android.support:support-v4:23.0.3'
}
// compile 'com.kbeanie:image-chooser-library:[email protected]'
// compile 'com.kbeanie:image-chooser-library:[email protected]'
compile files('libs/isoparser-1.0-RC-27.jar')
compile files('libs/aspectjrt-1.8.7.jar')
compile project(':image-chooser-library')
compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.android.gms:play-services-plus:10.2.1'
compile 'com.appsflyer:af-android-sdk:[email protected]'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'javax.media:jmf:2.1.1e'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
+0
不幸的是没有工作 – Mysterious
@intelliJAniya你的意思是'编 'com.google.android.gms:发挥服务-GCM:10.2.1' “这个? – Mysterious