cordova-plugin-googleplus icon indicating copy to clipboard operation
cordova-plugin-googleplus copied to clipboard

plugin not working with cordova-plugin-firebase

Open Lucasq95 opened this issue 6 years ago • 21 comments

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

Lucasq95 avatar Apr 24 '18 16:04 Lucasq95

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

jobehi avatar Apr 27 '18 16:04 jobehi

@Lucasq95 you are the man!

leonardomontes avatar May 01 '18 02:05 leonardomontes

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

matjazonline avatar May 11 '18 16:05 matjazonline

@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 avatar May 21 '18 16:05 edufruit

@matjazonline Did anyone found a solution ?

edufruit avatar May 22 '18 10:05 edufruit

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 ?

MisaZ10 avatar May 28 '18 17:05 MisaZ10

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

edufruit avatar May 28 '18 18:05 edufruit

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

zankevich avatar Jun 06 '18 09:06 zankevich

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:+" />

hikelvin avatar Jun 06 '18 18:06 hikelvin

@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 🙂

BhargavKilambi avatar Jun 25 '18 19:06 BhargavKilambi

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>

michalakjan avatar Jul 05 '18 10:07 michalakjan

Thanks @Lucasq95 :100: your described solution worked for me!

andreybleme avatar Jul 11 '18 17:07 andreybleme

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

brianmak3 avatar Aug 09 '18 05:08 brianmak3

@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.

techno2mahi avatar Aug 10 '18 11:08 techno2mahi

@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.

Lucasq95 avatar Aug 10 '18 13:08 Lucasq95

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"

moshi100 avatar Nov 11 '18 18:11 moshi100

@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.

tracy-codes avatar Nov 23 '18 12:11 tracy-codes

thanks for this

mesqueeb avatar Jan 17 '19 14:01 mesqueeb

@Lucasq95 @hikelvin Thanks a lot!

kurtiev avatar Mar 28 '19 06:03 kurtiev

This solved my problem also. Thanks :)

ulrick avatar Nov 17 '19 12:11 ulrick

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

DuaneQ avatar Feb 09 '20 23:02 DuaneQ