arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1.01k stars 1.56k forks source link

Ionic3 project fails after installing cordova-plugin-firebase #725

Closed ThorvaldAagaard closed 6 years ago

ThorvaldAagaard commented 6 years ago

I have now used a full day to try to figure this out, I have installled plugins to update to correct version of play services, after trying to update by hand. I have tried many different version, tried to update gradle-files etc

I can now with all plugins (execpt cordova-plugin-firebase) build the app for android, but as soon as I add cordova-plugin-firebase to my project i get the

com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

I even gave up and tried the cordova-plugin-fcm but that also has issue with the google libraries

currently my config is

    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 6.4.0 browser 5.0.1 ios 4.5.4 
    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 

I am using play services 15.0.0

I am using the following plugins

call-number 1.0.4 "Cordova Call Number Plugin"
com.telerik.plugins.nativepagetransitions 0.6.5 "Native Page Transitions"
cordova-android-firebase-gradle-release 1.0.1 "cordova-android-firebase-gradle-release"
cordova-android-play-services-gradle-release 1.4.2 "cordova-android-play-services-gradle-release"
cordova-custom-config 5.0.2 "cordova-custom-config"
cordova-open-native-settings 1.5.1 "Native settings"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-app-preferences 0.99.3 "AppPreferences"
cordova-plugin-apprate 1.3.0 "AppRate"
cordova-plugin-background-mode 0.7.2 "BackgroundMode"
cordova-plugin-badge 0.8.7 "Badge"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-crop 0.0.3 "CropPluginWithRatio"
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-email-composer 0.8.15 "EmailComposer"
cordova-plugin-facebook4 2.1.0 "Facebook Connect"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-globalization 1.11.0 "Globalization"
cordova-plugin-google-analytics 1.8.3 "Google Universal Analytics Plugin"
cordova-plugin-inappbrowser 1.7.2 "InAppBrowser"
cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.3 "LocalNotification"
cordova-plugin-mauron85-background-geolocation 2.3.5 "CDVBackgroundGeolocation"
cordova-plugin-media 5.0.2 "Media"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.0 "SocialSharing"
cordova-sms-plugin 0.1.11 "Cordova SMS Plugin"
cordova-sqlite-storage 2.3.2 "Cordova sqlite storage plugin"
cordova.plugins.diagnostic 4.0.8 "Diagnostic"
es6-promise-plugin 4.2.2 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
uk.co.workingedge.phonegap.plugin.launchnavigator 4.2.1 "Launch Navigator"

And my guess is that it might be a conflict with google-analytics

But any tips for solving this would be appriciated.

jeudywr commented 6 years ago

I was having the exact same issue, got it to work by removing and re-adding the android platform:

ionic cordova platform remove android ionic cordova platform add android

After that, the build worked.

ThorvaldAagaard commented 6 years ago

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

alberthoekstra commented 6 years ago

I got thesame :-(

ThorvaldAagaard commented 6 years ago

Look at https://github.com/mauron85/cordova-plugin-background-geolocation/issues/446

Erick-Yataco commented 6 years ago

finally someone found a way to resolve this

soumak77 commented 6 years ago

closing as resolved