EddyVerbruggen / cordova-plugin-googleplus

:heavy_plus_sign: Cordova plugin to login with Google Sign-In on iOS and Android
567 stars 629 forks source link

Plugin not working. None of success and error callback called. #515

Open 1pluszone opened 6 years ago

1pluszone commented 6 years ago
 Login() {
   this.googlePlus.getSigningCertificateFingerprint().then((success) => {
    alert(JSON.stringify(success));
})

   if(this.firstTimeLogin != 1) {
      this.googlePlus.login().then((res) => {
        alert("login success "+res);
      }).catch((err) =>(alert("login failure "+err)))
   } else {
     this.googlePlus.trySilentLogin({}).then((res) => {
       alert("silent login success "+res);
     }).catch((err) =>(alert("silent login failure "+err)))
   }
  }

getSigningCertificateFingerprint() is returning an object promise (despite JSON stringify).

And neither googlePlus.login nor googlePlus.trySilentLogin is firing. No success call back, no error callback.

akshaypalekar16 commented 6 years ago

Neither Success call back nor the error call back function is executed. And even it is not throwing any error.

netomia commented 6 years ago

Same here with all latest software.

netomia commented 6 years ago

Seems it only fails with cordova-android 7.1.1.

Works when I use cordova-android 7.0.0.

fdambrosio commented 6 years ago

I have the same problem

SunilDhaker commented 6 years ago

Any updates on this ??

ephys commented 6 years ago

I have the same issue, looking at the output from logcat, I found that it was due to the class com.google.android.gms.common.api.Api$zzf being missing.

That class seems to be used by the GoogleApiClient builder: https://github.com/EddyVerbruggen/cordova-plugin-googleplus/blob/master/src/android/GooglePlus.java#L180

09-26 10:26:03.602 31756 31920 I GooglePlugin: Login!
09-26 10:26:03.602 31756 31920 I GooglePlugin: Building Google options
09-26 10:26:03.604 31756 31920 I GooglePlugin: Building GoogleApiClient
09-26 10:26:03.634 31756 31920 W System.err: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
09-26 10:26:03.635 31756 31920 W System.err:    at com.google.android.gms.auth.api.Auth.<clinit>(Unknown Source:0)
09-26 10:26:03.635 31756 31920 W System.err:    at nl.xservices.plugins.GooglePlus.buildGoogleApiClient(GooglePlus.java:188)
09-26 10:26:03.645 31756 31920 W System.err:    at nl.xservices.plugins.GooglePlus.execute(GooglePlus.java:91)
09-26 10:26:03.645 31756 31920 W System.err:    at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:117)
09-26 10:26:03.645 31756 31920 W System.err:    at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
09-26 10:26:03.645 31756 31920 W System.err:    at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
09-26 10:26:03.645 31756 31920 W System.err:    at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)
09-26 10:26:03.645 31756 31920 W System.err:    at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
09-26 10:26:03.645 31756 31920 W System.err:    at android.os.MessageQueue.nativePollOnce(Native Method)
09-26 10:26:03.645 31756 31920 W System.err:    at android.os.MessageQueue.next(MessageQueue.java:325)
09-26 10:26:03.646 31756 31920 W System.err:    at android.os.Looper.loop(Looper.java:142)
09-26 10:26:03.646 31756 31920 W System.err:    at android.os.HandlerThread.run(HandlerThread.java:65)
09-26 10:26:03.646 31756 31920 W System.err: 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.tapptic.lalibre-wLsxOoQ6tPG_FyKRTyhKXQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.tapptic.lalibre-wLsxOoQ6tPG_FyKRTyhKXQ==/lib/arm64, /system/lib64, /system/vendor/lib64]]
09-26 10:26:03.646 31756 31920 W System.err:    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
09-26 10:26:03.646 31756 31920 W System.err:    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
09-26 10:26:03.646 31756 31920 W System.err:    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
09-26 10:26:03.646 31756 31920 W System.err:    ... 12 more

I think this is due to having multiple plugins using conflicting versions of android.gms:play-services packages

Edit: this issue looks related https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/488

Edit: A recent commit added the possibility to define the version of play-services: https://github.com/EddyVerbruggen/cordova-plugin-googleplus/commit/e6df70db26b2312f3effff814e870a2ca615cfe4

Edit: I fixed my issue by updating the plugin and aligning the versions of the play-services packages with the other plugins my project uses.

jcmmv00 commented 6 years ago

I did have the same issue, first I did install "google plus plugin" and it worked but later I did install "google maps plugin" and could not log in anymore, no errors and nothing, so i did this modifications:

in Config.xml for those plugins I set the same version for "PLAY_SERVICES_VERSION"

<plugin name="cordova-plugin-googleplus" spec="^5.3.2">
        <variable name="PLAY_SERVICES_VERSION" value="15.0.1" />
</plugin>

<plugin name="cordova-plugin-googlemaps" spec="^2.4.6">
        <variable name="API_KEY_FOR_ANDROID" value="blablablabla" />
        <variable name="PLAY_SERVICES_VERSION" value="15.0.1" />
        <variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
</plugin>

Then in /platforms/android/project.properties I did change the value of versions for "play-services":

target=android-26 android.library.reference.1=CordovaLib android.library.reference.2=app cordova.system.library.1=com.android.support:support-v4:24.1.1+ cordova.system.library.2=com.soundcloud.android:android-crop:1.0.0@aar cordova.system.library.3=com.google.android.gms:play-services-auth:15.0.1 cordova.system.library.4=com.google.android.gms:play-services-identity:15.0.1 cordova.gradle.include.1=cordova-plugin-googlemaps/guarderiappprofes-tbxml-android.gradle cordova.system.library.5=com.google.android.gms:play-services-maps:15.0.1 cordova.system.library.6=com.google.android.gms:play-services-location:15.0.1 cordova.system.library.7=com.android.support:support-core-utils:27.+

heroInCommunity commented 5 years ago

indeed, it works although, for me it was necessary to run ionic cordova build android after.

marioshtika commented 5 years ago

You don't have to change /platforms/android/project.properties manually. You can pass it when you install your plugin.

$ cordova plugin add cordova-plugin-googleplus --save --variable REVERSED_CLIENT_ID=myreversedclientid --variable WEB_APPLICATION_CLIENT_ID=mywebapplicationclientid --variable PLAY_SERVICES_VERSION=15.0.1
ghost commented 5 years ago

This is happening to me. I updated my app merely to add the Google+ login. I built the app and uploaded to iOS and Google. It worked on Google, but it didn't work on iOS. So, I learnt that I had input the incorrect reverse id in the plugin tag in my config. To fix, I changed the config to reflect the correct iOS reverse id, updated the googleserviceinfo.plist and added 'xmlns:android="http://schemas.android.com/apk/res/android"' into my config too (as it something to do with admob-simple plugin - there was a collision). Rebuilt. Then, it worked parfaitement on iOS, but now, on Android, it won't even do any callback. Just blank.

Btw, thank you for the great plugin, it is really great. I am super stoked about google+ logins, I couldn't rely on the old email sign-up.

window.plugins.googleplus.isAvailable(function(avail) {alert(avail)}); returns true but. What should I do?

I fixed the issue by making sure to have all google play services and firebases at 15.0.1 in the build.gradle, as well as having added play_services_version tags to all google plugins with 15.0.1 as the value and of course using the most up-to-date, but now the app just return 12500. When I run the APK from Phonegap it works perfectly. But after google accepts the app and I run that, it return 12500.

peterpeterparker commented 5 years ago

Same happened to me today. In order to resolve my conflict, probably because I'm using the most actual cordova-plugin-firebasex plugin, I add to install google plus plugin with --variable PLAY_SERVICES_VERSION=17.0.0