多个dex文件定义Lcom/google/android/gms/internal/zzrx;
Multiple dex files define Lcom/google/android/gms/internal/zzrx;
我正在使用他们的 api 创建一个 Shopify Android 应用程序。我的应用程序还使用 Google firebase 进行登录。这是我的依赖。
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.shopify.mobilebuysdk:buy:2.0.2'
compile 'com.google.firebase:firebase-auth:9.6.1'
compile 'com.google.android.gms:play-services-auth:9.6.1'
}
当我尝试构建应用程序时出现此错误:
错误:任务“:app:transformClassesWithDexForDebug”执行失败。
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzrx;
我试图在我的 build.gradle(app) 中添加这个:
defaultConfig {
multiDexEnabled true
}
然后得到这个:
错误:任务“:app:transformClassesWithJarMergingForDebug”执行失败。
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzrx.class
如何在同一个项目中使用这两个库?
尝试添加这个,可能会对 build.gradle
有所帮助
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
已解决
我刚刚用这几行解决了我的问题:
configurations {
all*.exclude group: 'com.google.android.gms', module: 'play-services-wallet'
}
我正在使用他们的 api 创建一个 Shopify Android 应用程序。我的应用程序还使用 Google firebase 进行登录。这是我的依赖。
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.shopify.mobilebuysdk:buy:2.0.2'
compile 'com.google.firebase:firebase-auth:9.6.1'
compile 'com.google.android.gms:play-services-auth:9.6.1'
}
当我尝试构建应用程序时出现此错误:
错误:任务“:app:transformClassesWithDexForDebug”执行失败。
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzrx;
我试图在我的 build.gradle(app) 中添加这个:
defaultConfig {
multiDexEnabled true
}
然后得到这个:
错误:任务“:app:transformClassesWithJarMergingForDebug”执行失败。
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzrx.class
如何在同一个项目中使用这两个库?
尝试添加这个,可能会对 build.gradle
有所帮助packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
已解决
我刚刚用这几行解决了我的问题:
configurations {
all*.exclude group: 'com.google.android.gms', module: 'play-services-wallet'
}