从昨天开始我就有麻烦了。在我的实习中,我遇到了下面的构建错误,但我不明白为什么:
$ 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 plugins list
的输出,正如您所看到的,我没有support-v4/v13冲突:
$ 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"
{}
以下是更多信息:
$ cordova -v
7.0.1
$ ionic -v
2.1.4
发布于 2017-10-12 17:30:24
我将添加我的2美分,因为没有一个解决方案对我有效。只有一件事对我有效:
cordova plugin rm cordova-plugin-compat --force
cordova platform rm android
cordova platform add android@6.3.0
发布于 2017-10-26 23:11:30
我不得不这样做:
cordova plugin rm cordova-plugin-compat --force
cordova plugin add cordova-plugin-compat@1.2
cordova platform rm android
cordova platform add android@6.3.0
考虑到你不能简单地删除cordova-plugin-compat,因为像cordova-plugin-file这样的插件依赖于它。
发布于 2017-10-17 04:13:51
一种解决方案:降级cordova android platform @6.2.3
$ cordova platform remove android && cordova platform add android@6.2.3
https://stackoverflow.com/questions/46562289
复制相似问题