cordova-多个dex文件定义了Lcom/google/android/gms/iid/zzc [英] cordova - Multiple dex files define Lcom/google/android/gms/iid/zzc

查看:91
本文介绍了cordova-多个dex文件定义了Lcom/google/android/gms/iid/zzc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Android编译cordova应用程序,但出现此错误.有任何想法吗? 这是我得到的错误:

I am trying to compile a cordova app for android and I am getting this error. Any ideas? This is the error I am getting:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForArmv7Debug'.
> 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/iid/zzc;

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

我尝试在末尾添加--stacktrace --debug,但出现相同的错误.有什么想法吗?

I tried adding --stacktrace --debug at the end but I am getting the same error. Any ideas?

推荐答案

此问题是由两个或多个插件指定的Google Play服务库版本不匹配引起的.

This issue is caused by a mismatch of versions of the Google Play Services library specified by two or more plugins.

对我来说,解决方案是将我的一个插件phonegap-plugin-push升级到最新版本1.10.5.

The solution for me was to upgrade one of my plugins - phonegap-plugin-push - to the latest version 1.10.5.

之所以可行,是因为phonegap-plugin-push@1.10.5包含提交固定版本从10.2+11+.

This worked because phonegap-plugin-push@1.10.5 contains a commit which changed the pinned version from 10.2+ to 11+.

您的项目中很可能有另一个插件指定了com.google.android.gms:*:+,该插件目前也将解析为v11,因为当前这是最新版本.

Most likely you have another plugin in your project which specifies com.google.android.gms:*:+, which will currently also resolve to v11, because this is currently the latest release.

更新

由于我自己一直遇到此问题,因此我刚刚创建了一个插件,其中包含针对Play Services库冲突版本的插件的Gradle解决方法:

Since I've been encountering this problem myself, I've just created a plugin which contains a Gradle workaround for plugins containing conflicting versions of the Play Services library: cordova-android-play-services-gradle-release. You should just be able to add it to your problematic project and it should fix the build:

cordova plugin add cordova-android-play-services-gradle-release

这篇关于cordova-多个dex文件定义了Lcom/google/android/gms/iid/zzc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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