IONIC生成失败transformClassesWithDexForDebug
问题描述:
我试图运行我的IONIC应用程序在我的Android设备运行命令离子cordova运行android - 设备。但是,当它的建筑,科尔多瓦返回该错误IONIC生成失败transformClassesWithDexForDebug
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 Lcom/google/zxing/BarcodeFormat;
* 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: 51.779 secs
Error: cmd: Command failed with exit code 1 Error output:
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 Lcom/google/zxing/BarcodeFormat;
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[ERROR] An error occurred while running cordova run android --device (exit code1).
的cordova plugin ls
输出:
com.synconset.imagepicker 2.1.8 "ImagePicker"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-dialogs 1.3.3 "Notification"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-google-analytics 1.8.3 "Google Universal Analytics Plugin"
cordova-plugin-googleplus 5.1.1 "Google SignIn"
cordova-plugin-nativestorage 2.2.2 "NativeStorage"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.1 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-plugin-x-socialsharing 5.1.8 "SocialSharing"
es6-promise-plugin 4.1.0 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-barcodescanner 6.0.8 "BarcodeScanner"
phonegap-plugin-push 1.10.5 "PushPlugin"
答
我有同样的问题,几乎相同的设置。您是否尝试将cordova-plugin-facebook4
恢复到版本1.7.4?
对我来说,这不是一个解决方法,但现在是一种解决方法,只是为了让应用程序建立。
如果还原插件修复它,也可以看看https://github.com/phonegap/phonegap-plugin-barcodescanner/issues/535。
答
进入平台 - > Android的 - >的build.gradle
defaultConfig下添加multiDexEnabled true
这样
defaultConfig {
multiDexEnabled true
}
这个工作对我..
https://forum.ionicframework.com/t/help-with-build-failed-android-ionic/94396/8
'多DEX文件定义Lcom/google/zxing/BarcodeFormat' - 这表示Google条码库的多个定义,很可能是由科尔多瓦插件。请发布项目中使用的插件列表('cordova plugin ls') – DaveAlden
@DaveAlden我用输出编辑了我的帖子。 –