[Firebase Mobile] Incompatibility(conflicts) between firebase plugin and gogle login plugin

Forge Component
(22)
Published on 26 May by Patrícia Glória Ferreira
22 votes
Published on 26 May by Patrícia Glória Ferreira

Hi,

As per configuration guide. I implemented firebase mobile plugin and its working fine.

But google login plugin is not working after implementing firebase plugin.

for cross verify, I created another application with same identifier and without firebase and checked, its working fine but after adding firebase moblile plugin, its failed to open google login popup.

Can you provide us some logs? Can be alot of things.


If it builds, check the client id on the google login, most likely its an error there.

Hi Vitor David,

Application generated successfully. then i launch an app  but i didn't found any error log.

before firebase integration is working fine. user can login through google sign in. 

We didn't change any  thing related plugin. client id was same.   

Swapnil Shinde wrote:

Hi Vitor David,

Application generated successfully. then i launch an app  but i didn't found any error log.

before firebase integration is working fine. user can login through google sign in. 

We didn't change any  thing related plugin. client id was same.   


Can you try to connect a smart phone and debug it on the client side? Might be a hidden error there

HI Victor,

I already debug and checked in client side through chrome inspect. Still I did not find any thing.

please help me out from this issue.

Sorry for late reply!

HI Victor,

I debugged application through android studio. I found below error.


java.lang.NoClassDefFoundError: com.google.android.gms.auth.api.Auth
     at nl.xservices.plugins.GooglePlus.buildGoogleApiClient(GooglePlus.java:181)
     at nl.xservices.plugins.GooglePlus.execute(GooglePlus.java:88)
 Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
     at com.google.android.gms.auth.api.Auth.<clinit>(Unknown Source:0)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.Api$zzf" on path: DexPathList[[zip file "/data/app/com.iifl.leadapp-xzcuGtrWEIm66vMGL_jYjg==/base.apk"],nativeLibraryDirectories=[/data/app/com.iifl.leadapp-xzcuGtrWEIm66vMGL_jYjg==/lib/arm64, /data/app/com.iifl.leadapp-xzcuGtrWEIm66vMGL_jYjg==/base.apk!/lib/arm64-v8a, /system/lib64]]

Hi Swapnil

I went through the thread above & had a deep dive with Firebase Plugin & Google Login Plugin.

yes, there's a known conflict of cordova-plugin-firebase with cordova-plugin-googleplus, now that is because of the Gradle version incompatibilities. Both these Cordova plugins are a base for Forge-Firebase & Forge-GoogleLoginPlugin which you are using.

This is not related to firebase-plugin & same as with google-login-plus, it's in fact a custom flavor which is your requirement to implement, hence here's the below solution to fix it :

Instead of changing the firebase plugin which is already consuming the more often lates Gradle's dependencies :

implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.firebase:firebase-core:16.0.9'
classpath 'com.google.gms:google-services:4.3.3'

You need to play with GoogleLoginPlugin.

-----------------------------------------------------------------------------


Solution-1

GoogleLoginPlugin is using the Cordova-repo of EddyVerbruggen. If you have been used this in Extensibility configuration  :

{
    "plugin":
        {
            "url": "https://github.com/EddyVerbruggen/cordova-plugin-googleplus#5.0.3"
        }
}

then you better use below URL instead of what mention in the document of GoogleLoginPlugin.

{
    "plugin":
        {
            "url": "https://github.com/EddyVerbruggen/cordova-plugin-googleplus#8.4.0"
        }
}

I hope this new release may address the known issue of firebase-googlelogin conflict.

If the above doesn't fix your problem then you can definitely try below custom repository solution.

---------------------------------------------------------------------------

Solution-2

1- Clone this base-repository of GoogleLoginPlugin i.e EddyVerbruggen

2- Before you re-compile it, update the plugin.xml  file: You can Check the Location here.

Replace this :

     <!-- android -->
     <platform name="android">
     <preference name="PLAY_SERVICES_VERSION" default="15.0.1"/>
     <framework src="com.google.android.gms:play-services-auth:$PLAY_SERVICES_VERSION" />
     <framework src="com.google.android.gms:play-services-identity:$PLAY_SERVICES_VERSION" />

With this :

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

  3- Compile & download it as a resource file and add to your project / use the URL of your Custom Cloned Repo i.e this new one in Extensibility configuration  :

And Instead this:

{
    "plugin":
        {
            "url": "https://github.com/EddyVerbruggen/cordova-plugin-googleplus#XXX"
        }
}

Use your custom plugin URL.


So, in short, it just a matter of changing these two lines & using that updated cordova-repo :

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


enjoy,

assif


assif_tiger wrote:

Hi Swapnil

I went through the thread above & had a deep dive with Firebase Plugin & Google Login Plugin.

yes, there's a known conflict of cordova-plugin-firebase with cordova-plugin-googleplus, now that is because of the Gradle version incompatibilities. Both these Cordova plugins are a base for Forge-Firebase & Forge-GoogleLoginPlugin which you are using.

This is not related to firebase-plugin & same as with google-login-plus, it's in fact a custom flavor which is your requirement to implement, hence here's the below solution to fix it :

Instead of changing the firebase plugin which is already consuming the more often lates Gradle's dependencies :

implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.firebase:firebase-core:16.0.9'
classpath 'com.google.gms:google-services:4.3.3'

You need to play with GoogleLoginPlugin.

-----------------------------------------------------------------------------


Solution-1

GoogleLoginPlugin is using the Cordova-repo of EddyVerbruggen. If you have been used this in Extensibility configuration  :

{
    "plugin":
        {
            "url": "https://github.com/EddyVerbruggen/cordova-plugin-googleplus#5.0.3"
        }
}

then you better use below URL instead of what mention in the document of GoogleLoginPlugin.

{
    "plugin":
        {
            "url": "https://github.com/EddyVerbruggen/cordova-plugin-googleplus#8.4.0"
        }
}

I hope this new release may address the known issue of firebase-googlelogin conflict.

If the above doesn't fix your problem then you can definitely try below custom repository solution.

---------------------------------------------------------------------------

Solution-2

1- Clone this base-repository of GoogleLoginPlugin i.e EddyVerbruggen

2- Before you re-compile it, update the plugin.xml  file: You can Check the Location here.

Replace this :

     <!-- android -->
     <platform name="android">
     <preference name="PLAY_SERVICES_VERSION" default="15.0.1"/>
     <framework src="com.google.android.gms:play-services-auth:$PLAY_SERVICES_VERSION" />
     <framework src="com.google.android.gms:play-services-identity:$PLAY_SERVICES_VERSION" />

With this :

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

  3- Compile & download it as a resource file and add to your project / use the URL of your Custom Cloned Repo i.e this new one in Extensibility configuration  :

And Instead this:

{
    "plugin":
        {
            "url": "https://github.com/EddyVerbruggen/cordova-plugin-googleplus#XXX"
        }
}

Use your custom plugin URL.


So, in short, it just a matter of changing these two lines & using that updated cordova-repo :

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


enjoy,

assif



Be advised, you will get an error using the version 8.4.0 (archive failed, xcode build error 65), use the version 7.0.2.

You will manage to build but the IOS will not receive any push notifications.

Hi Assif and David,

I tried with all options which suggest by you both.

1. I changed version 5.3.2 to 8.4.0 application was generated successfully for android not for iOS having below error.

Failed to install 'cordova-plugin-googleplus': Error: Cannot find module 'q'

then i check google functionality, the pop-up issued is resolved but failed to login after choosing  google account or login through another google account. 

2. I fork google login plugin on personal git and used that git url instead of google login plugin git url. and i found same issue which i mentioned in 1st scenario 

3. I changed version 5.3.2 to 7.0.2 application was generated successfully for android and iOS both. but google functionality does not work.

please suggest if i did anything wrong.

Hi Swapnil,

Did you try the second solution which i mentioned:

Solution-2

1- Clone this base-repository of GoogleLoginPlugin i.e EddyVerbruggen

2- Before you re-compile it, update the plugin.xml  file: You can Check the Location here.

Replace this :

     <!-- android -->
     <platform name="android">
     <preference name="PLAY_SERVICES_VERSION" default="15.0.1"/>
     <framework src="com.google.android.gms:play-services-auth:$PLAY_SERVICES_VERSION" />
     <framework src="com.google.android.gms:play-services-identity:$PLAY_SERVICES_VERSION" />

With this :

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

  3- Compile & download it as a resource file and add to your project / use the URL of your Custom Cloned Repo i.e this new one in Extensibility configuration  :

And Instead this:

{
    "plugin":
        {
            "url": "https://github.com/EddyVerbruggen/cordova-plugin-googleplus#XXX"
        }
}

Use your custom plugin URL.


So, in short, it just a matter of changing these two lines & using that updated Cordova-repo :

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

Hi Assif,

As implemented solution 2. Please check the details.

Changed xml file URL (Click to check)

{
    "plugin":
        {
            "url": "https://github.com/SwapnilShinde89/cordova-plugin-googleplus.git#8.4.0",
            "variables": [{
                "name": "REVERSED_CLIENT_ID",
                "value": "com.googleusercontent.apps.589332126425-77q4j2on7i3b7p39rb0nknrdggbe8a84"
                }]
        }
}


Application was generated successfully for android not for iOS having below error.

Failed to install 'cordova-plugin-googleplus': Error: Cannot find module 'q'

I checked google functionality, the pop-up issue is resolved but failed to login after choosing  google account or login through another google account. 

I got error code 10 after debugging the application.

Debugged through below script:

var login;
alert($parameters.webapikey);
if($parameters.IsSilent)  login = window.plugins.googleplus.trySilentLogin;
else alert("False");login = window.plugins.googleplus.login;
alert("end");
login (
    {
        'scopes': $parameters.scopes,
    'webClientId': $parameters.webapikey,
    'offline': $parameters.offline,
    'approval_prompt':$parameters.approval_prompt
   },
    function (obj) {
        alert("success");
        console.log(JSON.stringify(obj));
        $parameters.success = true;
        $parameters.message = "";
        $parameters.object = JSON.stringify(obj);
        $resolve();
    },
    function (msg) {
        alert('called');
        alert("failed");
        alert(msg); //After click on account details google through error on this line error : 10
        console.log(msg);
        $parameters.success = false;
        $parameters.message = msg;
        $parameters.object = "";
        $resolve();
    }
);

Kindly find attached video it will help to understand my issue..

Hello,

There's no video attached :)

you can share me in the message.

This thread went quiet.  Was there a solution identified?

Hi Andy,
This issue was fixed after updating the GoogleLocationPlugin.. i.e using the latest version.

Hi Assif,

I used latest version of Google login plugin, with repo : "url": "https://github.com/andregrillo/cordova-plugin-googleplus.git",

Also using firebase mobile plugin in application.

But while build application getting below error in iOS build.

In iOS on 2020-06-12 at 09:33:19 - An unexpected error has occurred while generating your application. Please try again. If the problem persists, contact OutSystems Support.

There is no error details. Also if we use both plugin separately then its working. But failed when use both the plugins.

Please suggest.

Thank you,

Regards

Vikas 

Hello Every one,

can you please provide .OML file if it is possible.


Thanks

Vikas Sharma wrote:

Hi Assif,

I used latest version of Google login plugin, with repo : "url": "https://github.com/andregrillo/cordova-plugin-googleplus.git",

Also using firebase mobile plugin in application.

But while build application getting below error in iOS build.

In iOS on 2020-06-12 at 09:33:19 - An unexpected error has occurred while generating your application. Please try again. If the problem persists, contact OutSystems Support.

There is no error details. Also if we use both plugin separately then its working. But failed when use both the plugins.

Please suggest.

Thank you,

Regards

Vikas 

Hi Vikas,


The Firebase Plugin and Google login uses some common code or library so many time while building the apps they conflicts each other and  to solve that you have to remove that particular library from either of the plugin.


For Android you can follow assif answer, Although I did not have any issue with latest plugins in android


For iOS, I found that there is a common library called 'GoogleUtilities' used in both plugins so in that case I need to remove this from anyone of the library. So I decided to remove it from Google plugin and for that I have created a GIT FORK of Cordova Google plugin and removed the dependent library from config.xml. Then I just replace the URL of the Cordova plugin in my app and build it, after that it it working fine.

Please check in the below fork link if you want to check the solution

https://github.com/pjain168/cordova-plugin-googleplus


Hope this helps.


Thanks

Pankaj