IONIC2 transformClassesWithDexForDebug [英] IONIC2 transformClassesWithDexForDebug

查看:188
本文介绍了IONIC2 transformClassesWithDexForDebug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误


`FAILURE:构建失败并出现异常。

`FAILURE: Build failed with an exception.

出了什么问题?


任务执行失败':transformClassesWithDexForDebug'。
com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.dex.DexException:多个dex文件定义Lcom /谷歌/斑马线/ BarcodeFormat;
`

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; `

我启用了Multidex( multiDexEnabled = true)在 build.gradle 中,还添加了以下内容

I have enabled Multidex (multiDexEnabled = true) in build.gradle and also added following

dexOptions {
      incremental = true;
      preDexLibraries = false
      javaMaxHeapSize "2g"
    }

但是仍然得到那个错误。

but still getting that error.

推荐答案

即使我遇到类似问题,我也尝试更新Cordova,Ionic并设置ANDROID_HOME和JAVA_HOME几乎所有的解决方案都在网上,但没有任何对我有用。最后,这是PhoneGap-push插件的问题。 2.0版本的PhoneGap-push插件与某些插件发生冲突,例如

Even I was facing the similar issue, I tried updating Cordova, Ionic and setting ANDROID_HOME and JAVA_HOME and almost all the solution over the web, but nothing worked for me. Finally, it was the issue with PhoneGap-push plugin. The 2.0 version of PhoneGap-push plugin has some collision with some plugins like

Google Analytics

更具体地说,使用谷歌播放服务的插件。

To be more specific the plugins that use google play services.

以下是我的解决方案。


  1. 首先,删除PhoneGap-push来自您的应用程序的插件2.0。

  2. 现在尝试通过评论使用推送插件的所有行来构建应用程序。

  3. 如果构建成功则这将是推送插件的问题。然后按照以下说明解决问题。如果构建不成功,那么您可能会遇到其他问题。

  4. 首先,卸载PhoneGap-push插件2.0

  5. 然后转到项目 - > package.json并搜索push并用更换行:4.0.1之前它将是4.3.0或4.3.1

  6. 现在再次添加push插件使用以下命令离子插件的项目添加phonegap-plugin-push@1.10.5 - 变量SENDER_ID = XXXXXXX

  7. 现在构建你的应用程序就像一个魅力....

  1. First, remove the PhoneGap-push plugin 2.0 from your application.
  2. Now try to build the app by commenting all the lines that use push plugin.
  3. If the build is successful then it will be the issue with push plugin. Then follow below instructions to fix the issue. If the build is not successful then you might be having some other issue.
  4. First, uninstall the PhoneGap-push plugin 2.0
  5. Then go to project -> package.json and search for push and replace the line with "": "4.0.1" earlier it will be 4.3.0 or 4.3.1
  6. Now add push plugin again to the project with below command ionic plugin add phonegap-plugin-push@1.10.5 --variable SENDER_ID=XXXXXXX
  7. Now build your app works like a charm....

此问题已在 phonegap-pushplugin repo 。他们有一个发布2.1.0版本的下一个里程碑,它将解决这个问题。

This issue is already opened in phonegap-pushplugin repo . They have a next milestone of releasing version 2.1.0 which will be fixing this issue.

这篇关于IONIC2 transformClassesWithDexForDebug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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