简体   繁体   English

当我尝试安装pushwoosh并编译为android时,始终会收到错误消息:Cordova

[英]Keep getting error when I try install pushwoosh and compile to android: Cordova

This is what happens when I install push woosh 这是当我安装woosh时发生的情况

:transformClassesWithDexForDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/iid/MessengerCompat$1;
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
    at com.android.dx.command.dexer.Main.run(Main.java:277)
    at com.android.dx.command.dexer.Main.main(Main.java:245)
    at com.android.dx.command.Main.main(Main.java:106)


 FAILED

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: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

* 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: 1 mins 1.862 secs
Error: Error code 1 for command: /Users/apple/usd/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/apple/usd/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

Build Gradle dependencies as requested 根据要求构建Gradle依赖项

 dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
    }

When I uninstall pushwoosh plugin the app works perfectly 当我卸载pushwoosh插件时,该应用程序可以正常运行

如果您在项目中使用自定义Application类,则应从android.support.multidex.MultiDexApplication继承它,以使multidex工作。

You may or may not hit the dex method count limit. 您可能达到或未达到dex方法计数限制。 Check out this thread that lists a couple of options to troubleshoot this: Java finished with non-zero exit value 2 - Android Gradle 签出此线程,其中列出了几个选项来解决此问题: Java完成,退出值2为非零-Android Gradle

Multidex 多重指数

If you have an issue compiling the app and you're getting an error similar to this (com.android.dex.DexException: Multiple dex files define): 如果您在编译应用程序时遇到问题,并且收到与此类似的错误(com.android.dex.DexException:定义了多个dex文件):

UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes; 异常最高级别异常:com.android.dex.DexException:多个dex文件定义了Landroid / support / annotation / AnimRes; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334) at com.android.dx.command.dexer.Main.run(Main.java:277) at com.android.dx.command.dexer.Main.main(Main.java:245) at com.android.dx.command.Main.main(Main.java:106) Then at least one other plugin you have installed is using an outdated way to declare dependencies such as android-support or play-services-gcm. 在com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)在com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)在com.android.dx.merge.DexMerger.mergeClassDefs (DexMerger.java:535)在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)在com.android.dx.merge.DexMerger.merge(DexMerger.java:189)在com.android。 com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)位于com.android.dx.command.dexer.Main处的dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)。然后在com.android.dx.command.Main.main(Main.java:106)处运行com.android.dx.command.dexer.Main.main(Main.java:245)处的(Main.java:277)然后您安装的至少一个其他插件正在使用一种过时的方式声明依赖项,例如android-support或play-services-gcm。 This causes gradle to fail, and you'll need to identify which plugin is causing it and request an update to the plugin author, so that it uses the proper way to declare dependencies for cordova. 这会导致gradle失败,您需要确定是哪个插件导致了问题,并要求对插件作者进行更新,以便它使用正确的方法来声明cordova的依赖关系。 See this for the reference on the cordova plugin specification, it'll be usefull to mention it when creating an issue or requesting that plugin to be updated. 请参阅此以获取关于cordova插件规范的参考,在创建问题或请求更新该插件时将其提及会很有用。

Common plugins to suffer from this outdated dependency management are plugins related to facebook, google+, notifications, crosswalk and google maps. 受过时的依赖关系管理影响的常见插件是与Facebook,google +,通知,人行横道和google地图相关的插件。

This error means you have two classes with the same names during the linking (dexer) phase. 此错误意味着在链接(dexer)阶段中,您有两个具有相同名称的类。

Multiple dex files define Lcom/google/android/gms/iid/MessengerCompat$1;

It looks like other plugin is referencing google play services library directly. 看来其他插件直接引用了Google Play服务库。

The correct way of referencing it on Cordova is through gradle (as Pushwoosh plugin is doing): 在Cordova上引用它的正确方法是通过gradle(如Pushwoosh插件所做的那样):
https://github.com/Pushwoosh/pushwoosh-phonegap-plugin/blob/master/plugin.xml#L102 https://github.com/Pushwoosh/pushwoosh-phonegap-plugin/blob/master/plugin.xml#L102

Find the other plugin who is referencing google-play-services.jar or similar and remove (just delete) this library from there. 找到另一个引用google-play-services.jar或类似文件的插件,然后从那里删除(只是删除)此库。

Similar issue: 类似问题:
https://github.com/Pushwoosh/pushwoosh-phonegap-plugin/issues/179#issuecomment-222638452 https://github.com/Pushwoosh/pushwoosh-phonegap-plugin/issues/179#issuecomment-222638452

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取注册错误:在Android中集成GCM for pushwoosh时缺少帐户 - Getting register error :Account missing when integrating GCM for pushwoosh in android 当我尝试在 android studio 上运行我的颤振应用程序时,请一直收到此错误 - Please I keep getting this error when I try to run my flutter app on android studio 当我尝试使用Google crashlytics时,我一直收到错误消息 - i keep getting an error when i try to use google crashlytics 当我在UBUNTU 14.04上尝试使用Android Studio中的Gradle进行编译时,继续收到此错误 - Keep getting this error when I'm trying to compile with Gradle in Android Studio on UBUNTU 14.04 当我尝试通过cordova创建一个android应用程序时,我该如何解决这个错误消息“无法安装'cordova-plugin-firebase'”? - How can i fix this error message saying “failed to install 'cordova-plugin-firebase'” when i try to create an android app through cordova? 在 pushwoosh 中进行注册时出错 - getting error when doing registarion in pushwoosh 使用Cordova 3.4和Pushwoosh错误构建Android应用 - Error build android apps using cordova 3.4 and pushwoosh Cordova和PushWoosh - 使用Android - 状态栏中没有消息 - Cordova and PushWoosh - with Android - No message in statusbar 在Ionic上Pushwoosh cordova插件出错 - Error with Pushwoosh cordova plugin on Ionic 当我尝试安装我的Android应用时清单错误 - Error in manifest when i try to install my android app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM