Android studio APK 构建错误transformClassesWithJarMergingForDebug [英] Android studio APK buil error transformClassesWithJarMergingForDebug

查看:26
本文介绍了Android studio APK 构建错误transformClassesWithJarMergingForDebug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建 APK,但在尝试构建时出现错误.

I'm trying to build APK, but there is an error when I try to make it.

错误:任务:app:transformClassesWithJarMergingForDebug"的执行失败.

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/android/gms/gcm/PendingCallback.class

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/gcm/PendingCallback.class

以下是我的 build.gradle(Module:app)

Following is my build.gradle(Module:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "jordan.personicle"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile files('libs/ajt-2.9.jar', 'libs/javaml-0.1.7.jar')
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.android.gms:play-services:11.0.1'
    compile 'com.google.firebase:firebase-database:10.2.1'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'

    compile 'com.firebase:firebase-jobdispatcher:0.6.0'

    compile 'org.jsoup:jsoup:1.7.3'
    compile 'com.android.support:multidex:1.0.0'

    testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

这是我的 build.gradle(项目)

This is my build.gradle (Project)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
        repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我认为 gcm 没有重复.有什么问题?

I think there is no duplication for gcm. What is the problem?

谢谢,

推荐答案

确保您在所有 google play 服务库中使用相同版本:

Make sure you use the same version in all your google play services libs:

compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'

参见https://stackoverflow.com/a/42610163/1370087

这篇关于Android studio APK 构建错误transformClassesWithJarMergingForDebug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆