错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败. > com.android.build.api.transform.TransformException [英] Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException

查看:74
本文介绍了错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败. > com.android.build.api.transform.TransformException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是android的新手.我试图在我的应用程序中添加Google登录功能,但是当我在build.gradle文件中添加com.google.android.gms:play-services-auth:17.0.0时,

I'm new at android. I'm trying to add Google sign in feature in my app but when i add com.google.android.gms:play-services-auth:17.0.0 in my build.gradle file,

我正在关注此错误:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: androidx/versionedparcelable/CustomVersionedParcelable.class

请提出解决方案,我整天都无法解决.

Kindly suggest solution, i spend whole day but cant get solution.

Build.gradle代码是:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "29.0.1"
    defaultConfig {
        multiDexEnabled true
        applicationId "com.example.mawai.smartlearn"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
     compile 'com.android.support:multidex:1.0.0'

    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 'com.android.support:appcompat-v7:26.+'
     compile 'com.android.support:appcompat-v7:28.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'

     compile 'com.google.android.gms:play-services-auth:17.0.0'
}

推荐答案

在17.0.0及更高版本中,您需要使用AndroidX,因此具有 2个选项:

1)将 com.google.android.gms:play-services-auth 降级到旧版本

2)将AndroidX添加/迁移到您的应用中(推荐)

2) Add/Migrate AndroidX to your app (Recommended)

选中此链接以进行迁移

Check this link for migration

这篇关于错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败. > com.android.build.api.transform.TransformException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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