ChatGPT解决这个技术问题 Extra ChatGPT

This version of the application is not configured for billing through Google Play

When I try to run my application with in-app billing I am getting the error: "This version of the application is not configured for billing through Google Play. Check the help center for more information".

I have the billing permission already in the Manifest file and I have a signed .apk uploaded as a draft onto Google Play and I have also installed that same signed apk onto my phone.

Any help on how to solve this issue?

I have this problem on real device, but not on emulator. I install the same build on the emulator and device. I logged in as the same user on both emulator and device. On device I got this-version-of-the-application-is-not-configured-for-billing error, on emulator everything works normally and dialog with test card appears. What the difference?

l
longi

This error may be caused by several reasons.

Here is the list of requirements for the Google IAB testing.

Prerequisites:

AndroidManifest must include "com.android.vending.BILLING" permission. APK is built in release mode. APK is signed with the release certificate(s). (Important: with "App Signing by Google Play" it only works if you download directly from GooglePlayStore!) APK is uploaded to alpha/beta distribution channel (previously - as a draft) to the developer console at least once. (takes some time ~2h-24h). IAB products are published and their status set to active. Test account(s) is added in developer console.

Testing requirements:

Test APK has the same versionCode as the one uploaded to developer console. Test APK is signed with the same certificate(s) as the one uploaded to dev.console. Test account (not developer) - is the main account on the device. (Main account might be not necessary - according to @MinosL comment) Test account is opted-in as a tester and it's linked to a valid payment method. (@Kyone)

P.S: Debugging with release certificate: https://stackoverflow.com/a/15754187/1321401 (Thnx @dipp for the link)

P.P.S: Wanted to make this list for a long time already.

Thnx @zlgdev, @Kyone, @MinosL for updates


Don't forget to make sure the account you're using to test IAB is opted-in as a tester using the "opt-in URL" generated once you've uploaded a build; AND that it's linked to a valid payment method.
Shouldn't it be easier to just test IAP? Or to test things in general..
also worth noting; test account should not be linked to developer account (should not have access to upload APK)
also worth noting; if "App signing certificate" is enabled, then we cannot use our local APK to test with real purchases since we cannot sign with signing certificate. (took me like 3 hours to find out)
I've been successfully testing with 1) a signed debug app that is 2) not the main account on the device, so the process for Google IAB testing seems to be not as strict as noted above.
C
Community

Ahh found the solution after trying for a couple of hours.

Google takes a while to process applications and update them to their servers, for me it takes about half a day. So after saving the apk as a draft on Google Play, you must wait a few hours before the in-app products will respond normally and allow for regular purchases. Export and sign APK. Unsigned APK trying to make purchases will get error.


Wow, is this serious? Just ran into the same problem. Did everything Google asked me to do in order to test in-app billing, but still getting the same evasive error message. I guess I'll have to wait and see. But does Google really expect us developers to wait hours each time we need to update our app in order to implement in-app billing? It seems quite inappropriate to me, to say the least.
Can you test while connected to Android Studio / running while connected to the debugger? Or do you need to install the release apk via USB?
Is there an easier way to test the purchase process other than, Android Tools > Export signed project... etc, then manually copy APK across to device, Test, .... repeat? I must be missing something?
Seriously, I cannot use the application with debug certificate and test In-App Billing?
Note that you CAN use debug builds, straight from your IDE as you are working. You just need to change the debug keystore to one that matches your release store. See this post for more information on how: stackoverflow.com/questions/10886814/…
s
sandalone

The same will happen if your published version is not the same as the version you're testing on your phone.

For example, uploaded version is android:versionCode="1", and the version you're testing on your phone is android:versionCode="2"


can u tell please me what if uploaded version is android:versionCode="1" and phone is android:versionCode="2" dose it ok or i have to change my apk google play ?.
What you need to do is to bump down the local version to "1" so it matches the current live version, as least temporarily for testing.
Looks like there are 2 common fixes to this error depending on your situation. In my case it was this one.
Thank you, this was the issue. Was debugging fine with release signed apk on my attached device. Then, changed the versioncode and it started getting the 1005 error. whew!
@Anna be aware that -1005 is also USER_CANCELLED if you use iabHelper
P
Pavel Chuchuva

In the old developer console:

Settings -> Account details -> License Testing -> Gmail accounts with testing access and type here your accounts

In new developer console:

Setup -> License Testing -> Type your Gmail account, hit 'Enter' and click 'Save'.

https://i.stack.imgur.com/sskgA.png


Works like a charm.
Hi my email is added in the license account. Still i am getting the error
Special attention to the hit 'Enter' part. I was just clicking save and the emails were not being added to the list.
I can't ever repay you enough for saving my life, my marriage, and my sanity with this answer. Bless you.
This also works for me, but I have one concern. How can I be sure that this will work when the app is published?
E
Evan Leis

You need to sign your APK with your live certificate. Then install that onto your test device. You can then test InAppBilling. If you are testing your application by direct run via eclipse to device(In debug mode) then you will get this error.

If you are using android.test.purchased as the SKU, it will work all the way, but you won't have the developerPayload in your final response.

If you are using your own draft in app item you can test all the way but you will be charged and so will have to refund it yourself afterwards.

You cannot buy items with the same gmail account that you use for the google play development console.


+1 Running from debugger uses debug certificate. After exporting the app and creating a new public key (and installing it in the developer console), just email yourself the apk and install it from your gmail inbox.
If I want to try "android.test.purchased" am I then going to change the SKU in both my code and in the developer console?
d
dor506

Conclusions in 2021

For all of you who concerned about debugging - You CAN run and debug and test the code in debug mode

Here's how you can test the process:

(This of course relies on the fact that you have already added and activated your products, and your code is ready for integration with those products)

Add com.android.vending.BILLING to the manifest Upload signed apk to internal testing Add license testers (Play console -> Settings -> License testing) - If you use multiple accounts on your device and you're not sure which one to use, just add all of them as testers. Run the application, as you normally would, from Android Studio (* The application should have the same version code as the one you just uploaded to internal testing)

I did the above and it is working just fine.


I can't ever repay you enough for saving my life, my marriage, and my sanity with this answer. Bless you.
Worked for me too. I was able to test in app purchase in my flutter app using an emulator. (i am using in_app_purchase library in flutter)
don't forget to add com.android.vending.BILLING to your debug/AndroidManifest.xml file.
I skipped step 1 and it is working for testing purposes. I did that on behalf this article developer.android.com/google/play/billing/…
Beautiful, worked for me! Very nice solution.
L
Lawrence Gimenez

If you're here from 2018, you need to download the APK directly from Play Store and install the "derived" APK. Maybe it is because of Google's Play Store has a feature "App Signing by Google Play".


Which APK? I am using AIDL do i still need to do that?
@ZhenLiu I guess not needed
In addition, the app cannot be already installed on the device by a different means (ie. Android Studio). Installation/update from the Play Store will work, but the IAP will not - you'll get the OPs error.
How do we debug this?
A
Amalka

This will happen if you use a different version of the apk than the one in the google play.


M
Mahmoud

2022 Answer:

This is tested for debug/release builds & either if the app is signed by Play Signing (which means the signing certificate of the delivered app from Google Play is different from the certificate when installing the app from your machine using Android Studio).

check these following steps:

Create your product on Google Play Console and activate it. Add license testers (open the Google Play Console -> Settings -> License Testing). Add all the Google accounts listed on your android device. Upload signed app to the internal testing track (it must be in release mode). Use the testing link to check if the app is available to download (make sure the uploaded app version to the internal track matches the version you're testing in debug mode). It takes some time to see the latest uploaded version there, so I recommend clearing the cache of the Play Store app. Run your app in debug mode from Android Studio. (Again, the app version and build number must match the values on the published version to the internal track).

I tested that on two different Google Play Console accounts (two different apps), and it works.


This is the correct answer if you still get the error after adding License Testing. Thank you!
S
Shree Harsha S

Let me just add what happened with me, may help some one.

It was mainly due to signing.

Since I have added the signing details in the Project structure, I was thinking that every time when I run, expected signed apk is getting installed. But build type 'debug' was selected.

Below fix solved the problem for me.

Generated signed apk of build type 'release'.

Manually installed the apk.


S
StephenDonaldHuffPhD

Contrary to many answers and comments on SO and other sites, you do NOT have to perform preliminary tests with an alpha/beta version of your product that has been downloaded from Google Play onto your test device (the alpha/beta publication process often eats up half a day). Neither do you have to load and re-load a signed release apk from your developer studio to your test device.

You CAN debug preliminary Google Play in app billing services using the debug app as loaded from your developer studio directly to your test device via ADB. If you are experiencing errors that prevent this, likely you have done something wrong in your code. Pay especially close attention to the CASE of your SKU's (product ids) and their format (for example, if you load your APK as com.mydomain.my_product_id, be sure your try to purchase it this way - providing the same case and domain). Also, pay especially close attention to your itemType - this should be either "inapp" or "subs" for managed/unmanaged in app purchases or subscriptions, respectively.

As suggested by Chirag Patel, provided you have your billing code properly established, perform all testing using the android.test.purchased Sku (product ID) during your preliminary tests. Check for this ID throughout your billing operations to pass it through signature, token and payload checks, since this data is not provided by the Google test system. Additionally, give one of your test products this ID to test its purchase, unlock/load and presentation all the way through your schema. To CLEAR the purchase, simply consume it, passing the same Sku AND a token string formatted this way - no other fields are relevant :

    "inapp:"+appContext.getAppContext().getPackageName()+":android.test.purchased";

Once you have completed this phase of testing, move to semi-live testing with your alpha/beta product. Create a Google group (essentially a mailing list), add your test users emails to it, and add/invite this group to test your device in this phase (performed at the "APK" portion of your app's Google developer listing). Purchases will be simulated but not actually charged - however to clear and re-test the purchases, Google indicates that you must refund them from your Google wallet. THIS is the only phase of testing that requires the time-consuming process of using alpha/beta loads and test users.


g
goRGon

In my case I saw the same message due to the different signatures of the installed apk and an uploaded to the market apk.


S
Søren

Had the same problem, and it was not solved before i read the post from DZDomi. It suddenly occurred to be that there is a setting in the Google Developer Console that you need to enable. In the "In app purchases" section, there's a line for your product and to the far right there's a status for it. It should be ACTIVE!


C
Community

If you want to debug IAB what do you have to do is:

Submit to google play a version of your app with the IAB permission on the manifest: Add a product to your app on google play: Administering In-app Billing Set a custom debug keystore signed: Configure Eclipse to use signed keystore


A
Anoop M Maddasseri

Recently google has implemented a change on their systems, and since you have uploaded at least one APK to your console, you can test your in-app requests with your app with any version code / number.

Cross reference LINK

Configure gradle to sign your debug build for debugging.

android {
    ...
    defaultConfig { ... }
    signingConfigs {
        release {
            storeFile file("my-release-key.jks")
            storePassword "password"
            keyAlias "my-alias"
            keyPassword "password"
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.release
            ...
        }
    }
}

G
Gal Rom

my problem was that i tried to check it with the debug.keystore , i mean running it through eclipse.I exported it with the keystore with which i published in alpha mode(it must be published before you can test it).installed it in my phone and than i could test it normally.


D
DZDomi

The problem also occurs, when you have added an in-app purchase after you uploaded the apk, but you have not published the application in the play store (alpha, beta and production).

Which basically means, that you have to add the In-App purchase AFTER you have published the apk in the Play store (alpha, beta and production). Otherwise you wont be able to purchase or query for the In-App purchase.


J
JDenais

Another reason not mentioned here is that you need to be testing on a real device. With the emulator becoming really good, it's an easy mistake to make.


A
Ali Akram

SOLUTION

Just hold on a while after uploading your app on play store because google takes some time to update app versions.It will work !


C
Chetan Sable

If you wanted to integrate with another app that is not published but has the same id, version code, and version name of deployed one so don't forget to edit appname.iml file version in flutter app because I stuck on to it with the same error.


M
Mathews P

If all the settings are OK and still you are getting the error This version of the application is not configured for billing through Google Play. Check the help center for more information.

Edit your In-App Products pricing in the Play Store or deactivate and activate the In-App products. This will solve the issue.


Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.