2

I have been trying to test the purchasing of Play store subscriptions on my device, but I have not succeeded despite following several step-by-step guides[1][2][3].

My ultmate aim is to test subscriptions on my USB connected device by building and installing the app with Android Studio. Unfortunately, it seems my only option right now is to to publish the app to the Alpha track on the Play Store, wait a few hours and download it every time I make a change.

The subscription products are queried successfully using BillingClient.querySkuDetailsAsync, but when I launch the billing flow (via BillingClient.launchBillingFlow) I see the following alert on the screen:

Error

This version of the application is not configured for billing through Google Play. Check the help centre for more information.

OK

I also see the following in the console:

W/ProxyBillingActivity: Activity finished with resultCode 0 and billing's responseCode: 5
W/BillingHelper: Couldn't find purchase lists, trying to find single data.
W/BillingHelper: Received a bad purchase data.
    Couldn't find single purchase data as well.

The response code 5 indicates a developer error:

Invalid arguments provided to the API. This error can also indicate that the application was not correctly signed or properly set up for In-app Billing in Google Play, or does not have the necessary permissions in its manifest.

My app is published to Internal, Alpha and Beta release tracks with the same version name and version code as the locally built APK. In the Play console, I have created a License Tester and added it to the Alpha track's testers, then opted the tester in to the Alpha track via a link. On my device, I am logged in with the tester's Google account.

I have tried building an APK signed with the release certificate, with a matching version name & code to the APK published in the store. I was at first using the "Run" and "Debug" buttons in Android Studio, but discovered that they built an unsigned[7] APK no matter how I configured the signing configs. Instead, I build using the Build->Make Project menu item, and install the resulting signed APK using ADB[5]. The "Active Build Variant" is set to "Release".

It occurred to me that it may be impossible to sign a locally built APK with the same key as the APK distributed by the Play store, as my app has "Play App Signing" enabled (which causes Google to re-sign the APK using a different key, which is inaccessible to me). However, there is a thread on StackOverflow which suggests other have had success even when using Play App Signing[6].

I have also tried waiting several days between publishing a new build to the Alpha track and trying to purchase a subscription, as I read that the Play Store sometimes takes up to 24 hours to process builds.

I am using Android Studio 4.2 on MacOS 10.15.7, with a Samsung A5 phone for testing.

Update 2022

I never found workaround for this on my Samsung A5 running Android 8. However, I purchased a Samsung A52 (running Android 12) and it does not exhibit this problem.

diachedelic
  • 2,195
  • 1
  • 24
  • 28
  • Have you checked that the account which is added in the licence testers is the only account logged in your phone ? – Shivam Yadav May 16 '21 at 07:20
  • And if you want to debug your release builds you can set the signinConfigs and set debuggable true and then you can debug your release builds aslo. – Shivam Yadav May 16 '21 at 07:28

3 Answers3

0

you need to increase the version and upload that version as beta publish.

mostly duplication please check This version of the application is not configured for billing through Google Play

Imtiyaz Khalani
  • 2,037
  • 18
  • 32
  • I am testing with an APK which uses the same version number, version code and signing key as the APK which is published as a beta. – diachedelic May 15 '21 at 03:58
  • @diachedeliccan you also check SKU id are you testing with same is exist in product list? check for test sku ids https://medium.com/bleeding-edge/testing-in-app-purchases-on-android-a6de74f78878 – Imtiyaz Khalani May 16 '21 at 09:45
0

If two apps differ in the signing key or in the package, then Google Play considers them different applications

Both debug & release versions should use the same signing key, I can make test purchases while debugging via USB on Android Studio with no problemas

something like this on the app build.gradle :

 buildTypes {
        release {                        
            signingConfig signingConfigs.mykey
            debuggable false; 
            ....
        }
        debug {
            debuggable true
            signingConfig signingConfigs.mykey
            ....
        }
    }
from56
  • 3,976
  • 2
  • 13
  • 23
0

There's a utility called "lucky patcher" which modifies app code in order to allow for bypassing in app purchases (yes, it's used for piracy, but I'm pretty sure it's not piracy to bypass your own app). You could try using it to test your app.

And in case you haven't already, once you're done, protect against it by following this: Lucky patcher, how can I protect from it?