Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google play service stops working when I make a purchase with android.test.purchased

Tags:

android

Bundle buyIntentBundle = inappService.getBuyIntent(3, this.getPackageName(), "android.test.purchased", "inapp", "myUserId");
int responseCode = buyIntentBundle.getInt("RESPONSE_CODE");
if (responseCode == 0) {
   PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
   this.startIntentSenderForResult(pendingIntent.getIntentSender(), PURCHASE_REQUEST_CODE, new Intent(), 0, 0, 0);
}

It appears that right when i execute the code above, my google play service will stop running (crash?)

This used to work about couple days ago. But now it has stopped.

Do you guys know what I can do? When I tested with a real product with beta testing users everything still works.

Here is the added stack trace. Looks like it comes from Google Play Store itself.

    07-21 14:28:51.172 18056-18224/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
                                                       Process: com.android.vending, PID: 18056
                                                       java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:318)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
Caused by: java.lang.NullPointerException: Attempt to read from field 'long com.google.wireless.android.finsky.dfe.nano.an.b' on a null object reference
at com.google.android.finsky.billing.lightpurchase.s.a(SourceFile:5)
at com.google.android.finsky.billing.lightpurchase.h.doInBackground(SourceFile:27)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
at java.lang.Thread.run(Thread.java:762) 
like image 630
Zhen Liu Avatar asked Jul 21 '17 14:07

Zhen Liu


Video Answer


2 Answers

I contacted with Google Developer Support and they said it's "Google Play Store bug"

Google Reply:

We are aware of this issue, and our engineers are currently investigating it. I will provide more updates as soon as I get any information from them.

So there is no need to do anything about this crash. Just wait for bug fixes on Google Play Store App.


EDIT(08.08.2017)

Today the "android.test.purchased" crash problem fixed. The Google Play Store App version is 8.0.73.R-all [0] [PR] 162689464 now.

like image 87
MarsPeople Avatar answered Sep 25 '22 02:09

MarsPeople


As per @MarsPeople said on comment It's because of google play store's new update (version 8.0.26.R-all [0] [PR] 161173660). I tested(in app billing) around 3-4 device which contain this google play store version so in that device google play store crash and get nullpointer exception, but When I uninstall the update and test it with older version (like in my case version 5.1.11) it work perfectly but after some time play store update forcefully (version 8.0.26.R-all [0] [PR] 161173660) and then I tried it then google play store crash. So yes we have to wait until google give new update on this issue :)

but surprisingly it work perfectly with real SKU which is provided from google console. and not work with test SKU (android.test.purchased)

I hope this will help someone who get this issue on google play store version 8.0.26.R-all [0] [PR] 161173660

like image 24
Harin Kaklotar Avatar answered Sep 26 '22 02:09

Harin Kaklotar