Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

plugin not working with cordova-plugin-firebase #487

Open
Lucasq95 opened this issue Apr 24, 2018 · 21 comments
Open

plugin not working with cordova-plugin-firebase #487

Lucasq95 opened this issue Apr 24, 2018 · 21 comments

Comments

@Lucasq95
Copy link

I've encountered an issue when trying to work with this plugin and cordova-plugin-firebase.
I implemented googleplus login in my app and everything worked fine. The problem appeared when i added cordova-plugin-firebase to work with push notifications.
After adding firebase plugin when trying to login google's auth modal wasn't displayed and i had no error logged.
After some digging i found that in the android project.properties the following libraries where using old versions:
com.google.android.gms:play-services-identity:11.0.8
com.google.android.gms:play-services-auth:11.0.8

while all firebase libraries where using + version.

I changed play-services versions to + and everything worked.

I think that an update is needed on this versions in the plugin, cause they are very old compared to the latest release which is v 15.0.0 https://developers.google.com/android/guides/releases

@jobehi
Copy link

jobehi commented Apr 27, 2018

YES ! Thanks @Lucasq95 !
for those facing the same issue after running cordova, reproduce this :
cordova platform rm android
cordova platform add android
change the libraries version in plateforms/android/project.properties to +
cordova run android

@leonardomontes
Copy link

@Lucasq95 you are the man!

@matjazonline
Copy link

I get still get this after adding the plugin to ionic 3 with firebase:

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 2s
37 actionable tasks: 1 executed, 36 up-to-date
(node:24482) UnhandledPromiseRejectionWarning: Error: /Users/allisnow/dev/yexApp/platforms/android/gradlew: 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

@edufruit
Copy link

@Lucasq95 : I am also stuck at the firebase issue, this ain't working with firebase plugin, the login checker hangs without any alert error message, but I am using Phonegap Build, Kindly help me out on your solution to how to execute your solution on Phonegap Build.

@edufruit
Copy link

edufruit commented May 22, 2018

@matjazonline Did anyone found a solution ?

@MisaZ10
Copy link

MisaZ10 commented May 28, 2018

did you try change project.properties ?
cordova.system.library.10=com.google.android.gms:play-services-auth:11.8.0
cordova.system.library.11=com.google.android.gms:play-services-identity:11.8.0

by

cordova.system.library.10=com.google.android.gms:play-services-auth:15.0.0
cordova.system.library.11=com.google.android.gms:play-services-identity:15.0.0

in Android project ?

@edufruit
Copy link

ok, i will try this one. also can you let me know how to implement this on phonegap build

@zankevich
Copy link

zankevich commented Jun 6, 2018

@MisaZ10 Is there possibility to define these versions via ionic/cordova?

@hikelvin
Copy link

hikelvin commented Jun 6, 2018

This worked for me too. I changed it to "+".

If you want to make it so you don't have to manually change the project.properties in the platform/android folder every time you remove and add the platform, you can change the value of the same thing in plugins/cordova-plugin-googleplus/plugin.xml.

<!-- android -->
  <platform name="android">

    <framework src="com.google.android.gms:play-services-auth:+" />
    <framework src="com.google.android.gms:play-services-identity:+" />

@BhargavKilambi
Copy link

@matjazonline for your issue go to your project root folder and do this
cordova clean
And then
cordova build
This should help you with that Dex Merger issue 🙂

@michalakjan
Copy link

michalakjan commented Jul 5, 2018

if you are using for build ionic pro platform or basically don't want to change this inside project.properties or cordova-plugin then you can use cordova-plugin-platform-replace plugin, all you need to add this plugin to your project

ionic cordova plugin add cordova-plugin-platform-replace

and then add to your config.xml

<platform name="android">
      <replace-string file="project.properties" find="com.google.android.gms:play-services-auth:11.8.0" replace="com.google.android.gms:play-services-auth:+" />
      <replace-string file="project.properties" find="com.google.android.gms:play-services-identity:11.8.0" replace="com.google.android.gms:play-services-identity:+" />
</platform>

@andreybleme
Copy link
Contributor

Thanks @Lucasq95 💯 your described solution worked for me!

@brianmak3
Copy link

brianmak3 commented Aug 9, 2018

Thanks man, this saved my day
cordova.system.library.5=com.google.android.gms:play-services-auth:+`
cordova.system.library.6=com.google.android.gms:play-services-identity:+

@techno2mahi
Copy link

techno2mahi commented Aug 10, 2018

@Lucasq95 Can you please confirm the versions of you both the plugins ie cordova-plugin-firebase.
and googleplus> I have also added this plugin . But in my platfor>android.Gradle.properties file the versions are coming like this
cordova.system.library.8=com.google.android.gms:play-services-auth:11.8.0
cordova.system.library.9=com.google.android.gms:play-services-identity:11.8.0

I am getting this build error message
Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

I have tried by changing them to + but no luck so far. Please help, its killing me.

@Lucasq95
Copy link
Author

Lucasq95 commented Aug 10, 2018

@techno2mahi i haven't tried cordova-android-play-services-gradle-release so i dont know if its worth installing another package to manage versions. My advice is to keep it clean, uninstall both libraries and try installing them again and please show me what error the compiler throws.

Just a comment:
Every plugin should have its android dependencies with an updated version so it is not your responsability to manage versions. However if libraries dont match then you can do as I did and verify versions yourself but this is not recommended.

@moshi100
Copy link

After 2 days trying to fix it I found a solution, in my case the following plugins caused a crash: cordova-admob-sdk, cordova-plugin-firebase and I changed manually the play-services-ads version in "project.properties" and "build.gradle" files from "com.google.android.gms:play-services-ads:+" to "com.google.android.gms:play-services-ads:16.0.0"

@tracy-codes
Copy link

@michalakjan Thank you so much for your suggestion, this worked perfectly for me. I know adding another dependency isn't the greatest thing to do... but I'm just trying to learn native Google Auth and this was the biggest pain in my ass until I found your solution. Thank you, sir.

@mesqueeb
Copy link
Collaborator

thanks for this

@kurtiev
Copy link

kurtiev commented Mar 28, 2019

@Lucasq95
@hikelvin
Thanks a lot!

@ulrick
Copy link

ulrick commented Nov 17, 2019

This solved my problem also. Thanks :)

@DuaneQ
Copy link

DuaneQ commented Feb 9, 2020

I'm getting the same error as @matjazonline after manually changing the project properties to +. Any suggestions for those cases?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests