transistorsoft / cordova-background-geolocation-SampleApp

Cordova Background Geolocation Sample Application
https://www.transistorsoft.com/shop/products/cordova-background-geolocation
MIT License
122 stars 78 forks source link

Push notification error #45

Closed KproApps2 closed 8 years ago

KproApps2 commented 8 years ago

Hi ,

We have an issue with the plugin as followes:

When trying to add a push notification system on to the app with transistorsoft/cordova-background-geolocation on android we get the following error and ios just stops working.

When I uninstall the plugin transistorsoft/cordova-background-geolocation it works fine.

Below is the error

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.

BUILD FAILED

Total time: 1 mins 56.288 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

Reason

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):

UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define 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. 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. 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.

Common plugins to suffer from this outdated dependency management are plugins related to facebook, google+, notifications, crosswalk and google maps.

christocracy commented 8 years ago

2 plugins are requiring 2 different versions of a play-services dep. show me your plugins.

I'm using the most modern form of dependency mgmt (Gradle file). Some other plugin is screwing up.

On Friday, June 3, 2016, KproApps2 notifications@github.com wrote:

Hi ,

We have an issue with the plugin as followes:

When trying to add a push notification system on to the app with transistorsoft/cordova-background-geolocation on android we get the following error and ios just stops working.

When I uninstall the plugin transistorsoft/cordova-background-geolocation it works fine.

Below is the error

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 56.288 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

Reason

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):

UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define 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. 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. 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.

Common plugins to suffer from this outdated dependency management are plugins related to facebook, google+, notifications, crosswalk and google maps.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-background-geolocation-SampleApp/issues/45, or mute the thread https://github.com/notifications/unsubscribe/AAA6l_E6cf3tkrqe-35U1SjC6-hckVwEks5qH8kHgaJpZM4ItPSf .

Snet form Gmail Mobile

KproApps2 commented 8 years ago

APPLEs-MacBook-Pro-2:USD UltimateCoder$ cordova plugin cordova-plugin-camera 2.2.0 "Camera" cordova-plugin-compat 1.0.0 "Compat" cordova-plugin-whitelist 1.2.1 "Whitelist" pushwoosh-cordova-plugin 5.1.1 "Pushwoosh"

KproApps2 commented 8 years ago

http://stackoverflow.com/questions/37605624/keep-getting-error-when-i-try-install-pushwoosh-and-compile-to-android-cordova/37610923#37610923

christocracy commented 8 years ago

Here's my build.gradle

https://github.com/transistorsoft/cordova-background-geolocation-lt/blob/master/src/android/build.gradle

On Monday, June 6, 2016, KproApps2 notifications@github.com wrote:

http://stackoverflow.com/questions/37605624/keep-getting-error-when-i-try-install-pushwoosh-and-compile-to-android-cordova/37610923#37610923

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-background-geolocation-SampleApp/issues/45#issuecomment-224122809, or mute the thread https://github.com/notifications/unsubscribe/AAA6ly3PedAhuTkcmTwiv4e6QOVR0VqMks5qJLISgaJpZM4ItPSf .

Snet form Gmail Mobile

KproApps2 commented 8 years ago

Okay so my test was I deleted your line of code saved and run compile 'com.google.android.gms:play-services-location:+'

This has the same result...

christocracy commented 8 years ago

On my SampleApp

$cordova plugin add pushwoosh-cordova-plugin
$ cordova plugins
ford-2:SampleApp chris$ cordova plugins

com.transistorsoft.cordova.background-geolocation 1.6.2 "BackgroundGeolocation"
cordova-plugin-background-fetch 3.0.4 "CDVBackgroundFetch"
cordova-plugin-console 1.0.2 "Console"
cordova-plugin-device 1.1.1 "Device"
cordova-plugin-dialogs 1.2.1 "Notification"
cordova-plugin-splashscreen 3.1.0 "Splashscreen"
cordova-plugin-statusbar 2.1.0 "StatusBar"
cordova-plugin-whitelist 1.2.1 "Whitelist"
pushwoosh-cordova-plugin 5.1.2 "Pushwoosh"
$ cordova build android
.
.
.
:compileDebugNdk UP-TO-DATE
:compileDebugSources
:transformClassesWithDexForDebug
:mergeDebugJniLibFolders UP-TO-DATE
:transformNative_libsWithMergeJniLibsForDebug
:processDebugJavaRes
:transformResourcesWithMergeJavaResForDebug
:validateDebugSigning
:packageDebug
:zipalignDebug
:assembleDebug
:cdvBuildDebug

BUILD SUCCESSFUL

Total time: 23.142 secs
Built the following apk(s):
    /Users/chris/Documents/workspace/cordova/background-geolocation/SampleApp/platforms/android/build/outputs/apk/android-debug.apk

Works for me. Have you tried completely destroying your Android app and re-adding?

$ cordova platform remove android
$ cordova platform add android
$ cordova build android
christocracy commented 8 years ago

Have you updated your Android SDK? Ensure the following:

KproApps2 commented 8 years ago

Hi Chris,

Yes my SDK is updated as you will see below the message from PUSHWOOSH

Vitaly Romanychev (Pushwoosh)

Jun 7, 19:18 ICT

Hi Kingsley,

I have just heard back from our developers and it turns out that the issue could be caused by minimal required versions google-play-services and android-support-v4 (this was one of the recent additions in the last update). It looks like it was a bad idea to add this requirement as it caused some compatibility issues with other plugins, so in the most recent update it was removed. Please try updating our plugin and let us know about the results.

I look forward to hearing from you.

Kind regards, Vitaly Romanychev Pushwoosh Team

christocracy commented 8 years ago

android-support-v4 would be a bad idea

On Tuesday, June 7, 2016, KproApps2 notifications@github.com wrote:

Hi Chris,

Yes my SDK is updated as you will see below the message from PUSHWOOSH

Vitaly Romanychev (Pushwoosh)

Jun 7, 19:18 ICT

Hi Kingsley,

I have just heard back from our developers and it turns out that the issue could be caused by minimal required versions google-play-services and android-support-v4 (this was one of the recent additions in the last update). It looks like it was a bad idea to add this requirement as it caused some compatibility issues with other plugins, so in the most recent update it was removed. Please try updating our plugin and let us know about the results.

I look forward to hearing from you.

Kind regards, Vitaly Romanychev Pushwoosh Team

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-background-geolocation-SampleApp/issues/45#issuecomment-224449327, or mute the thread https://github.com/notifications/unsubscribe/AAA6l-zYmmmt3jTrLhHIz1QhPiUgCE1Wks5qJgVOgaJpZM4ItPSf .

Snet form Gmail Mobile

KproApps2 commented 8 years ago

Okay so some good news it is working with the new update from Push woosh :)

KproApps2 commented 8 years ago

:) thank you both for helping