This plugin is conflicting with Firebase Cloud Messaging
See original GitHub issueI have an existing application where I would like to use Firebase Cloud Messaging like described on https://angularfirebase.com/lessons/ionic-native-with-firebase-fcm-push-notifications-ios-android/
After following this guide my app can no longer compile - seems to be a problem with mixed version of google-play-services.
Starting from an empty project I have managed to reproduce the error from a blank starter project and following the guide (all works) and then adding the background location plugin and now it fails
Your Environment
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.9
Cordova Platforms : android 7.0.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v8.9.3
npm : 5.5.1
OS : Windows 10
Environment Variables:
ANDROID_HOME : D:\Documents\Android\Sdk
Context
Expected Behavior
Expect it to compile
Actual Behavior
Compilation fails with DEX-error
- What went wrong: Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Possible Fix
None found
Steps to Reproduce
I have now done a lot more testing, and I am able to reproduce the error following the following steps
ionic start demoapp
cd demoapp
npm install
ionic cordova plugin add cordova-plugin-firebase
npm install --save @ionic-native/firebase
npm install --save angularfire2@5.0.0-rc.6 firebase@4.9.0
(need to install these versions as newer version are not compatible with ionic 3 as it uses angular6)
ionic cordova build android
(notice this builds ok)
ionic cordova plugin add cordova-plugin-mauron85-background-geolocation
ionic cordova build android
(this will give a compile error as there are conflicting versions of google-play-services)
ionic cordova plugin add cordova-android-play-services-gradle-release
(this plugin aligns the google-play-service versions)
ionic cordova build android
Now I get the DEX-error
37 actionable tasks: 1 executed, 36 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
(node:57812) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
(node:57812) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
So it looks like a conflict between the 2 plugins, but I haven’t found a way to compile the solution, so any suggestions are welcome
Context
Unable to combine notifications and geolocation
Debug logs
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (1 by maintainers)
Top GitHub Comments
Yes, as I wrote I installed cordova-android-play-services-gradle-release and that removed the compile error, and introduced the DEX-error.
I did not find any documentation of how to change
so I just left it, as I assumed it would use whatever cordova-android-play-services-gradle-release was setting up
But as you wrote in the readme, the DEX could also be an issue with the support libraries, so I add a 3rd plugin for managing these libraries
And VOILA !! - Now it compiles, and you are welcome to close this issue, but should probably consider adding a link to these plugins as they are solving a problem
The error reoccured when upgrading some of the plugins, and that is probably what the problem you have
I ended up removing all the plugins that updated the play services, and changed my configuration to
but I am migrating to Ionic-V4 and it will be interesting to see how that will go