作者:温暖不醒的aprildRi-1965 | 来源:互联网 | 2023-02-01 11:47
我正在尝试编译一个用于Android的cordova应用程序,我收到此错误.有任何想法吗?这是我得到的错误:
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但是我得到了同样的错误.有任何想法吗?
1> DaveAlden..:
此问题是由两个或多个插件指定的Google Play服务库版本不匹配引起的.
对我来说,解决方案是将我的一个插件 - phonegap-plugin-push - 升级到最新版本1.10.5.
这有效,因为phonegap-plugin-push@1.10.5
包含一个提交,它将固定版本更改10.2+
为11+
.
很可能你的项目中有另一个插件指定com.google.android.gms:*:+
,当前也会解析为v11,因为这是目前最新版本.
更新
由于我自己遇到过这个问题,我刚刚创建了一个插件,其中包含一个Gradle解决方法,用于包含Play服务库冲突版本的插件:cordova-android-play-services-gradle-release.您应该只能将它添加到有问题的项目中,它应该修复构建:
cordova plugin add cordova-android-play-services-gradle-release