artberri / cordova-plugin-play-games-services

Cordova Plugin For Google Play Game Service
39 stars 32 forks source link

crashes app on launch #4

Closed Phildo closed 4 years ago

Phildo commented 4 years ago

cordova --version shows 9.0.0 (cordova-lib@9.0.1)

cordova plugins shows cordova-plugin-play-games-services 1.1.2 "PlayGamesServices" (among others).

I have this code in my javascript:

function cordovainit()
{
  ...
  if(cordova && cordova.plugins && cordova.plugins.playGamesServices)
  {
    cordova.plugins.playGamesServices.auth(function() {
      // On logged in
      logged_in = 1;
    }, function() {
      // On not logged in
      logged_in = 0;
    });
  ...
}
document.addEventListener("deviceready", cordovainit, false);

If your plugin is installed (cordova plugin add cordova-plugin-play-games-services --variable APP_ID=com.mycompany.myapp), the app crashes on launch.

if it is removed (cordova plugin remove cordova-plugin-play-games-services --variable APP_ID=com.mycompany.myapp), the app functions normally (obviously, without google play services)

I am also unable to get crash log data (adb logcat appears to silently hang for some reason, as does adb logcat -b crash- though I'm sure those problems have nothing to do with your plugin).

Let me know if there are additional details I can provide to help!

Phildo commented 4 years ago

Some more info: when I comment out cordova.plugins.playGamesServices.auth(...);, it does not crash. So it's the actual calling of that function (as opposed to just the inclusion of your plugin) that's causing a crash. Any idea why this would be?

ollm commented 4 years ago

In https://github.com/ptgamr/cordova-google-play-game/issues/19#issuecomment-372981760 comment that in APP_ID you have to use the numerical value from the Google Play Console: Game Service section.

I have tried this in my application and it is no longer crashes when started, the achievements also work correctly (I have not tried other features).

You can find your APP_ID in https://play.google.com/apps/publish/#GameListPlace, open the app and the APP_ID will be under the name.

Then do the following:

cordova plugin remove cordova-plugin-play-games-services --variable APP_ID=you_wrong_app_id
cordova plugin add cordova-plugin-play-games-services --variable APP_ID=your_correct_numerical_app_id

Greetings.