多个dex文件定义Lorg / apache / cordova / BuildHelper [英] Multiple dex files define Lorg/apache/cordova/BuildHelper

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

问题描述

我从昨天开始遇到麻烦了。在我的实习中,我面临以下构建错误,但我无法理解原因:

I'm in trouble since yesterday. In my internship I faced the following build error, but I couldn't understand why :

$ cordova build android

[...]

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':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 Lorg/apache/cordova/BuildHelper;

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

BUILD FAILED

Total time: 3.379 secs
Error: /home/thor/Projects/App_CDP/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':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 Lorg/apache/cordova/BuildHelper;

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

以下是 cordova插件列表的输出,我没有support-v4 / v13冲突,你可以看到:

Here is the output of cordova plugins list, I don't have the support-v4/v13 conflict as you can see :

$ cordova plugin list
com.googlemaps.ios 2.2.0-fixed "Google Maps SDK for iOS"
com.moust.cordova.videoplayer 1.0.1 "Video Player"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-file 4.0.0 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googlemaps 1.4.0 "phonegap-googlemaps-plugin"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
{}

这里还有一些更多的信息:

Here are also some more informations:

$ cordova -v
7.0.1

$ ionic -v
2.1.4


推荐答案

您最有可能使用新发布的 cordova-android@6.3.0 ,现在包括 BuildHelper.java (如您的错误消息中所述)和 PermissionHelper.java ,但你仍然弃用了 cordova-plugin-compat 导致构建失败,因为它也包含se class

Most likely you are using the newly released cordova-android@6.3.0, which now includes BuildHelper.java (as noted in your error message) and PermissionHelper.java, but you still have the deprecated cordova-plugin-compat in your project which is causing the build to fail because it also contains these classes.

要解决此问题,请从项目中删除 cordova-plugin-compat 以卸载来自 cordova-android 平台项目的这些Java文件::

To fix this, remove cordova-plugin-compat from your project to uninstall these Java files from the cordova-android platform project::

cordova plugin rm cordova-plugin-compat --force

更新

要保留此更改,请添加 cordova-plugin-compat@1.2 ,其中包含引擎约束,以防止Java文件重新安装到 cordova-android@6.3 + 平台:

To persist this change add cordova-plugin-compat@1.2 which includes an engine constraint to prevent the Java files being re-installed into the cordova-android@6.3+ platform:

cordova plugin add cordova-plugin-compat@1.2

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

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