Cannot save game to cloud immediately after Purchase is made - + InApp Billing weird error

199 views Asked by At

I have a button in my LIBGDX game that is linked to a IabHelper.launchPurchaseFlow method. Immediately as I click it I get the below error in Logcat :

06-22 14:12:22.994     788-1120/? E/Parcel? Class not found when unmarshalling: com.google.android.finsky.billing.lightpurchase.PurchaseParams
    java.lang.ClassNotFoundException: com.google.android.finsky.billing.lightpurchase.PurchaseParams
            at java.lang.Class.classForName(Native Method)
            at java.lang.Class.forName(Class.java:251)
            at java.lang.Class.forName(Class.java:216)
            at android.os.Parcel.readParcelableCreator(Parcel.java:2133)
            at android.os.Parcel.readParcelable(Parcel.java:2097)
            at android.os.Parcel.readValue(Parcel.java:2013)
            at android.os.Parcel.readArrayMapInternal(Parcel.java:2314)
            at android.os.Bundle.unparcel(Bundle.java:249)
            at android.os.Bundle.getString(Bundle.java:1118)
            at android.content.Intent.getStringExtra(Intent.java:4991)
            at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1392)
            at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1016)
            at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:4227)
            at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:252)
            at com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:4108)
            at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:260)
            at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2583)
            at android.os.Binder.execTransact(Binder.java:404)
            at dalvik.system.NativeStart.run(Native Method)
     Caused by: java.lang.NoClassDefFoundError: com/google/android/finsky/billing/lightpurchase/PurchaseParams
            at java.lang.Class.classForName(Native Method)
            at java.lang.Class.forName(Class.java:251)
            at java.lang.Class.forName(Class.java:216)
            at android.os.Parcel.readParcelableCreator(Parcel.java:2133)
            at android.os.Parcel.readParcelable(Parcel.java:2097)
            at android.os.Parcel.readValue(Parcel.java:2013)
            at android.os.Parcel.readArrayMapInternal(Parcel.java:2314)
            at android.os.Bundle.unparcel(Bundle.java:249)
            at android.os.Bundle.getString(Bundle.java:1118)
            at android.content.Intent.getStringExtra(Intent.java:4991)
            at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1392)
            at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1016)
            at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:4227)
            at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:252)
            at com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:4108)
            at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:260)
            at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2583)
            at android.os.Binder.execTransact(Binder.java:404)
            at dalvik.system.NativeStart.run(Native Method)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.finsky.billing.lightpurchase.PurchaseParams" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
            at java.lang.Class.classForName(Native Method)
            at java.lang.Class.forName(Class.java:251)
            at java.lang.Class.forName(Class.java:216)
            at android.os.Parcel.readParcelableCreator(Parcel.java:2133)
            at android.os.Parcel.readParcelable(Parcel.java:2097)
            at android.os.Parcel.readValue(Parcel.java:2013)
            at android.os.Parcel.readArrayMapInternal(Parcel.java:2314)
            at android.os.Bundle.unparcel(Bundle.java:249)
            at android.os.Bundle.getString(Bundle.java:1118)
            at android.content.Intent.getStringExtra(Intent.java:4991)
            at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1392)
            at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1016)
            at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:4227)
            at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:252)
            at com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:4108)
            at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:260)
            at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2583)
            at android.os.Binder.execTransact(Binder.java:404)
            at dalvik.system.NativeStart.run(Native Method)

But this error does not break my purchase logic because IabHelper.OnIabPurchaseFinishedListener returns and the result is a valid purchase. I can also see the purchase in the Google Merchant Account immediately afterwards.

I have a problem though... Immediately after purchase I try to save my settings to google play games cloud but the Game.Snapshots.open method never returns (I never reach onPostExecute, and I don't see any error in Logcat):

  void saveSnapshot(final SnapshotMetadata snapshotMetadata) {
        AsyncTask<Void, Void, Snapshots.OpenSnapshotResult> task =
                new AsyncTask<Void, Void, Snapshots.OpenSnapshotResult>() {
                    @Override
                    protected Snapshots.OpenSnapshotResult doInBackground(Void... params) {
                        if (snapshotMetadata == null) {
                            Log.i(TAG_SAVE_GAME, "Calling open with " + mCurrentSaveName);
                            return Games.Snapshots.open(mGoogleApiClient, mCurrentSaveName, true)
                                    .await();
                        }
                        else {
                            Log.i(TAG_SAVE_GAME, "Calling open with " + snapshotMetadata);
                            return Games.Snapshots.open(mGoogleApiClient, snapshotMetadata)
                                    .await();
                        }
                    }

                    @Override
                    protected void onPostExecute(Snapshots.OpenSnapshotResult result) {
                        Log.i(TAG_SAVE_GAME, "Entered onPostExecute");
                        Snapshot toWrite = processSnapshotOpenResult(RC_SAVE_SNAPSHOT, result, 0);
                        if (toWrite != null) {
                            Log.i(TAG_SAVE_GAME, writeSnapshot(toWrite, data_tosave));
                            is_finished_on_saving = true;
                            success_on_saving = true;
                        }
                        else {
                            Log.e(TAG_SAVE_GAME, "Error opening snapshot: " + result.toString());
                            is_finished_on_saving = true;
                            success_on_saving = false;
                        }
                    }
                };

        task.execute();
    }
0

There are 0 answers