Crashes on Android static tests

I am having problems trying to make a trial purchase from an Android app. I tried to implement in-app billing after the official tutorial and then decided to use the checkout library to make things easier for me. Unfortunately, I ran into the same problem in both cases.

When I try to make a purchase, the android popup popup will appear for a short while, download it for a moment and then the app crashes. I see the following error in logcat:

06-24 13:42:05.485 1558-2697/? E/Parcel: Class not found when unmarshalling: com.google.android.finsky.billing.common.PurchaseParams
                                         java.lang.ClassNotFoundException: com.google.android.finsky.billing.common.PurchaseParams
                                             at java.lang.Class.classForName(Native Method)
                                             at java.lang.Class.forName(Class.java:400)
                                             at android.os.Parcel.readParcelableCreator(Parcel.java:2517)
                                             at android.os.Parcel.readParcelable(Parcel.java:2471)
                                             at android.os.Parcel.readValue(Parcel.java:2374)
                                             at android.os.Parcel.readArrayMapInternal(Parcel.java:2727)
                                             at android.os.BaseBundle.unparcel(BaseBundle.java:269)
                                             at android.os.BaseBundle.getString(BaseBundle.java:992)
                                             at android.content.Intent.getStringExtra(Intent.java:6702)
                                             at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:336)
                                             at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1097)
                                             at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:6275)
                                             at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:339)
                                             at com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:6019)
                                             at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:298)
                                             at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3573)
                                             at android.os.Binder.execTransact(Binder.java:573)
                                          Caused by: java.lang.ClassNotFoundException: com.google.android.finsky.billing.common.PurchaseParams
                                             at java.lang.Class.classForName(Native Method)
                                             at java.lang.BootClassLoader.findClass(ClassLoader.java:1346)
                                             at java.lang.BootClassLoader.loadClass(ClassLoader.java:1406)
                                             at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                             at java.lang.Class.classForName(Native Method) 
                                             at java.lang.Class.forName(Class.java:400) 
                                             at android.os.Parcel.readParcelableCreator(Parcel.java:2517) 
                                             at android.os.Parcel.readParcelable(Parcel.java:2471) 
                                             at android.os.Parcel.readValue(Parcel.java:2374) 
                                             at android.os.Parcel.readArrayMapInternal(Parcel.java:2727) 
                                             at android.os.BaseBundle.unparcel(BaseBundle.java:269) 
                                             at android.os.BaseBundle.getString(BaseBundle.java:992) 
                                             at android.content.Intent.getStringExtra(Intent.java:6702) 
                                             at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:336) 
                                             at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1097) 
                                             at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:6275) 
                                             at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:339) 
                                             at com.android.server.am.ActivityManagerService.startActivityIntentSender(ActivityManagerService.java:6019) 
                                             at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:298) 
                                             at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3573) 
                                             at android.os.Binder.execTransact(Binder.java:573) 
                                          Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

06-24 13:42:05.504 614-4655/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
06-24 13:42:05.661 28655-28655/? E/Zygote: v2
06-24 13:42:05.663 28655-28655/? E/Zygote: accessInfo : 0
06-24 13:42:05.707 1148-1329/? E/QC-NETMGR-LIB: Unsupported attribute type, ignoring 0x8
06-24 13:42:05.707 1148-1329/? E/QC-NETMGR-LIB: unrecognized ifindex 6
06-24 13:42:05.708 1148-1329/? E/QC-NETMGR-LIB: Unsupported attribute type, ignoring 0x8
06-24 13:42:05.708 1148-1329/? E/QC-NETMGR-LIB: unrecognized ifindex 6
06-24 13:42:05.742 4563-4677/? E/ContactsProvider_EventLog: Flush buffer to file cnt : 1 size : 0Kb duration : 7ms lastUpdatedAfter : 4014 ms mFlush_time_threasold : 2000 mCurrentSize : 487
06-24 13:42:05.938 21138-28711/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #5
                                                   Process: com.android.vending, PID: 21138
                                                   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:761)
                                                    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:761) 

      

Using the checkout library, the actual code to make a purchase is very simple:

//SKU_PREMIUM is set to "android.test.purchased" and PURCHASE_DEVPAYLOAD is set to a random string of characters "T?ate755S,26B361Ml2nXxWW31H8Ex"
private final ActivityCheckout mCheckout = Checkout.forActivity(this, StethoApplication.getInstance().getBilling());
private Inventory mInventory;

private void configBilling() {
    mCheckout.start();

    mCheckout.createPurchaseFlow(new PurchaseListener());

    mInventory = mCheckout.makeInventory();
    mInventory.load(Inventory.Request.create()
            .loadAllPurchases()
            .loadSkus(ProductTypes.IN_APP, PremiumFragment.SKU_PREMIUM), new InventoryCallback());
}
public void purchasePremium() {
        mCheckout.whenReady(new Checkout.EmptyListener() {
            @Override
            public void onReady(BillingRequests requests) {
                requests.purchase(ProductTypes.IN_APP, PremiumFragment.SKU_PREMIUM, PremiumFragment.PURCHASE_DEVPAYLOAD, mCheckout.getPurchaseFlow());
            }
        });
    }

      

This column has the same problem, but this post deals with an actual "live" test purchase instead of a static test purchase. I also saw several posts say that you must be signed in to a different google account than your developer account, but again, that's for testing live shopping.

Since I had the same problem with my custom billing code as well as the validation library, I assume it is a configuration issue. I uploaded the alpha version of the app to google play and then used the public key from the developer console to initialize the library. I think this might be causing the problem, but I'm not sure.

If someone can point me in the right direction, I would really appreciate it.

+3


source to share





All Articles