Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException

女生的网名这么多〃 提交于 2020-01-14 05:48:04

问题


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 build.gradle file, i got this error:

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 code is :

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'

}


回答1:


In version 17.0.0 and above, you need to use AndroidX, so you have 2 options:

1) Downgrade com.google.android.gms:play-services-auth to older version

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

Check this link for migration



来源:https://stackoverflow.com/questions/57149570/errorexecution-failed-for-task-apptransformclasseswithjarmergingfordebug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!