0

I have in app purchase functionality in my app using google play store. I updated my play version to 11.0.1 from 9.8.0. After updating while trying to purchase a product in staging I am getting the popup saying google play store has stopped. But it's working fine in the production. I am a bit confuse is this crash happening because of the play service updation.

I am getting the below crash:

E/AndroidRuntime: FATAL EXCEPTION: main
                                                                        Process: com.firstrun.prototyze, PID: 10412
                                                                        Theme: themes:{default=overlay:system, iconPack:system, fontPkg:system, com.android.systemui=overlay:system, com.android.systemui.navbar=overlay:system}
                                                                        java.lang.NullPointerException: Attempt to invoke interface method 'android.os.Bundle com.android.vending.billing.IInAppBillingService.getBuyIntent(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String)' on a null object reference
                                                                            at com.android.mobiefit.sdk.manager.PurchaseManager.purchase(PurchaseManager.java:123)
                                                                            at com.firstrun.prototyze.ui.selectprogram.ProgramPurchaseDetailActivity$8.onRequestSuccess(ProgramPurchaseDetailActivity.java:379)
                                                                            at com.android.mobiefit.sdk.manager.TransactionManager.lambda$transactionEvent$0(TransactionManager.java:46)
                                                                            at com.android.mobiefit.sdk.manager.TransactionManager$$Lambda$1.accept(Unknown Source)
                                                                            at io.reactivex.internal.observers.ConsumerSingleObserver.onSuccess(ConsumerSingleObserver.java:59)
                                                                            at io.reactivex.internal.operators.single.SingleObserveOn$ObserveOnSingleObserver.run(SingleObserveOn.java:81)
                                                                            at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:109)
                                                                            at android.os.Handler.handleCallback(Handler.java:739)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                            at android.os.Looper.loop(Looper.java:148)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:5461)
                                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

and here is my purchase manager:

//Last parameter - RUN=false, BODY=true
    public boolean purchase(String productShortcode, String sku, Activity activityObj, boolean subscription) throws RemoteException, IntentSender.SendIntentException {
        Log.d(TAG, "Start Purchase");
        String type = "inapp";
        if(subscription)    {
            type = "subs";
        }
        Bundle buyIntentBundle = mService.getBuyIntent(3, activityObj.getPackageName(),
                sku, type, productShortcode);
        for(String key : buyIntentBundle.keySet())  {
            Log.d("Purchase", key +" :: " + buyIntentBundle.get(key));
        }
        if(buyIntentBundle.getInt("RESPONSE_CODE", 0) == 7)    {
            Log.d(TAG, "Item is already purchased, consume and try again");
            return false;
        }
        PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
        activityObj.startIntentSenderForResult(pendingIntent.getIntentSender(),
                1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
                Integer.valueOf(0));
        return true;
    }

Can someone tell me what is the issue?

gaurav tiwari
  • 1,093
  • 1
  • 9
  • 28

2 Answers2

0

this is google play store version bug no need to worry about that.
just test in app purchase with older google play store version it will work :)

for more details refer this question

EDIT : Aug 11th 2017
Now in new google play store version 8.0.73.R-all [0] [PR] 162689464 google fix this crash issue and I have successfully tested it on my devices so now you don't face this problem anymore. :)

Harin Kaklotar
  • 305
  • 7
  • 22
0

In my P9 Lite when I try to start the application it crashes without any message. I had just tried cleaning the cache but the only solution is to delete the update and use the last version.

After 10 minutes google play finds the update, reinstalls the version 8..0.73.R-all [0] [PR] 162689464 and after 10 minutes the app crashes once more. I don't how I can solve this problem because the auto update of the apps starts with any problem.

recnac
  • 3,744
  • 6
  • 24
  • 46