I followed instructions from https://ionicframework.com/docs/native/google-plus/.
I’ve created Android Client in https://console.cloud.google.com/apis/credentials/oauthclient using correct SHA-1 (re-checked using keytool -list -printcert -jarfile <path to your apk>
)
Code for login is simple as in instruction:
this.googlePlus.login({})
.then(res => console.log(res))
.catch(err => console.error(err));
However, it never comes into neither then
nor catch
.
No error is displayed in console.
Ionic version 3.20.0
Cordova version 7.1.0
Ionic Native GooglePlus 5.3.0
Android phone version 5.1.1
cordova-plugin-googleplus 5.3.0
I’ve spent two days, Ionic Native Facebook is working fine, while GooglePlus is just failing silently.
Please advice.
UPDATE 1
It seems to be an issue with cordova-plugin-googleplus
, as when I am changing GooglePlus.execute
to use
@Override
public boolean execute(String action, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
this.savedCallbackContext = callbackContext;
savedCallbackContext.error(42);
action = "abracadabra";
... //remains unchanged
then I see in Chrome console 42 – this means, that error handling is not working properly in the cordova-plugin-googleplus plugin.
9
Answers
Finally, the root cause and solution was found. The issue happened because Google updated all com.google.android.gms:play-* modules and this affected all Google services cordova plugins.
If you are using only Google Plus plugin, then everything should be fine I think.
In other case, all dependencies in project.properties, plugin.xml files to
com.google.android.gms:play-*
should be replaced with older version 11.8.0:was
should be
I know, that this is better to be called a workaround, but no other solutions work.
Thanks guys from:
https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/492
https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/484
https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/488
UPDATE 08.10.2018
After last updates, plugin is again not working. The issue happened because of conflict of versions of ``com.google.android.gms:play-services-:`.
For instance,
com.google.android.gms:play-services-maps:15.0.1
, used by Google Maps plugin, andcom.google.android.gms:play-services-auth:11.8.0
used by Google Plus plugin.Solution is then straightforward:
config.xml
put<variable name="PLAY_SERVICES_VERSION" value="15.0.1" />
(instead of15.0.1
there could be newer/older version) to every plugin, which uses play services - normally all plugins related to Google services.platforms/android/project.properties
use everywhere for play services version15.0.1
(here should version the same as in point 1).I tried to change the android/project.properties, the lines with google_auth and identity to
cordova.system.library.5=com.google.android.gms:play-services-auth:+
cordova.system.library.6=com.google.android.gms:play-services-identity:+
Thank you heroin for the answer. My problem was with:
1) com.google.android.gms:play-services-tagmanager:+
2) com.google.android.gms:play-services-auth:11.8.0
3) com.google.android.gms:play-services-identity:11.8.0
What I did to fix it was as heroin suggested, but instead I delete the 11.8.0 for 2) and 3) and just replaced it with the “+”. Then I went into the config.xml found the:
variable name=”PLAY_SERVICES_VERSION” value=”11.8.0″
as heroin suggested, then replaced the “11.8.0” with “+”. Re-compiled and ran, and now google plus works again.
In my case same thing was happing and i tried almost 1 month and finally what worked for me is that i deleted my plugin folder and removed android platform and added it again. It worked for me. Hope it will help someone.
in
platforms>android>project.properties
change:
to:
In my case I fixed it by changing the values from play services to be the same because using different versions cause some errors
So I change these values
To
And delete platforms, www and plugins folder and execute the “ionic cordova build android” command and it all works.
i have the same issue with ionic 4.
the following change is fixed my issue :—–
before :
After :
you can find this settings on your “platform/android/project.properties” file.
you must uninstall your plugin :
and install again :
this worked for me.