Billing service unavailable on device как исправить ошибку

Ну, мы не можем помочь вам, не имея много информации. Вместо этого я постараюсь составить контрольный список для вас, если вы что-то пропустили:

1) Тестируете ли вы на эмуляторе? Сервисы биллинга должны быть протестированы на устройствах, НО, если вам действительно нужно тестировать на эмуляторе, убедитесь, что на эмуляторе установлена ​​и настроена программа google play. Это очень важно!

2) Вы установили правильное разрешение в манифесте? (Com.android.vending.BILLING)

3) Если вы все еще тестируете приложение, вы получили лицензию на тестовое приложение в playstore, импортировали lvl в ваш sdk, настроили библиотеку проверки лицензии? (вы можете следовать здесь: настройка

4) Правильно ли вы обрабатывали результат активности в onActivityResult? Как видно на примере из Google, вы должны сделать это следующим образом:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);

// Pass on the activity result to the helper for handling
if (!inappBillingHelper.handleActivityResult(requestCode, resultCode, data)) {
    super.onActivityResult(requestCode, resultCode, data);
}
else {
    Log.i(TAG, "onActivityResult handled by IABUtil.");
}
}

Также может быть полезно иметь больше информации, например, если вы тестируете на эмуляторе или устройстве, имя устройства, версию Android и т. Д.

Ну, мы не можем вам помочь, не имея большой информации. Поэтому вместо этого я попытаюсь сделать контрольный список, если вы что-то упустили:

1) Вы тестируете на эмуляторе? Биллинговые службы должны тестироваться на устройствах, НО если вы
действительно нужно протестировать эмулятор, убедитесь, что в эмуляторе установлена ​​и настроена игра Google. Это очень важно!

2) Вы установили правильное разрешение в манифесте? (Com.android.vending.BILLING)

3) Если вы все еще тестируете приложение, получили ли вы лицензию тестового приложения из игрового магазина, импортировали lvl в свой sdk, настроили свою библиотеку проверки лицензий? (вы можете следовать здесь: настройка

4) В вашей активности onActivityResult вы правильно обработали результат деятельности? Как видно из примера из google, вы должны сделать это следующим образом:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);

// Pass on the activity result to the helper for handling
if (!inappBillingHelper.handleActivityResult(requestCode, resultCode, data)) {
    super.onActivityResult(requestCode, resultCode, data);
}
else {
    Log.i(TAG, "onActivityResult handled by IABUtil.");
}
}

Также может быть полезно больше информации, например, если вы тестируете эмулятор или устройство, имя устройства, версию Android и т.д.

I’m trying to use In-App billing:

mIabHelper = new IabHelper(this, BILLING_KEY);
        mIabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
            @Override
            public void onIabSetupFinished(IabResult result) {
                if (!result.isSuccess()) {
                    Log.d(TAG, "Problem setting up In-app Billing: " + result);
                }
            }
        });

And getting the error:

Problem setting up In-app Billing: IabResult: Billing service unavailable on device. (response: 3:Billing Unavailable)

Why? Tried to clear cache of the Play Store, didn’t work for me.

asked Apr 8, 2013 at 21:38

artem's user avatar

1

Well we can’t help you without having much information.So instead I’ll try to do a checklist for you in case you missed something:

  1. Are you testing on an emulator?Billing services should be tested on devices,BUT if you
    really have to test on the emulator,make sure the emulator has google play installed and set up.This is very important!

  2. Did you set the correct permission in the manifest? (com.android.vending.BILLING)

  3. If you are still testing the app,did you get a test app licence from the playstore, imported the level in your SDK ,set up your licence verification library? (you can follow along here: setting up

  4. On your activity onActivityResult did you correctly handle the activity result?As seen on the example from google you should do it this way:


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
  Log.i(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);

  // Pass on the activity result to the helper for handling
  if (!inappBillingHelper.handleActivityResult(requestCode, resultCode, data)) {
    super.onActivityResult(requestCode, resultCode, data);
  }
  else {
    Log.i(TAG, "onActivityResult handled by IABUtil.");
  }
}

Also having more information could be useful, like if you are testing on the emulator or device, the device name, the android version etc…

Bruno Bieri's user avatar

Bruno Bieri

9,60411 gold badges63 silver badges90 bronze badges

answered Apr 11, 2013 at 11:22

sokie's user avatar

sokiesokie

1,93622 silver badges37 bronze badges

1

This error indicates that you’re connecting to the in-app billing service on your device, but that the service doesn’t support IAB version 3. It may be that your device’s version of Google Play only supports version 2 of IAB. What version of Google Play is running on your device?

Is your version of Google Play otherwise functional (e.g., can you open the Google Play store)? Sometimes, if the date on your device is off, or there is some other problem, Google Play itself can go South.

Finally, what’s in your logcat output? It would be easier to provide assistance if you provided more detail.

answered Apr 12, 2013 at 11:42

Carl's user avatar

CarlCarl

15.4k5 gold badges55 silver badges53 bronze badges

2

I got that error when I installed the App BEFORE I registered everything and set Google Play store up. Once I set the Google Play Store account up, the error went away.

answered Jul 21, 2013 at 13:10

Gene's user avatar

GeneGene

10.8k1 gold badge66 silver badges58 bronze badges

Wipe helped me. Strange error.

answered Apr 12, 2013 at 14:44

artem's user avatar

artemartem

16.2k34 gold badges112 silver badges188 bronze badges

4

The documentation for version 2.0 of the billing was actually more helpful than 3.0 for this one even though I’m using version 3.0 of the billing.

Here’s how 2.0 describes it Response Code 3:

Indicates that In-app Billing is not available because the API_VERSION
that you specified is not recognized by the Google Play application or
the user is ineligible for in-app billing
(for example, the user
resides in a country that prohibits in-app purchases).

For me I had to setup a test Google account on my phone first before testing. I forgot that step. Once I did that fixed it for me…

Look for Server Response Codes here:

http://developer.android.com/google/play/billing/v2/billing_reference.html

http://developer.android.com/google/play/billing/billing_reference.html

answered Jan 20, 2014 at 18:21

Nathan Prather's user avatar

Nathan PratherNathan Prather

2,0681 gold badge18 silver badges15 bronze badges

2

I found a problem to fix, try root with ur LuckyPatcher, open config Toggles -> Disable billing.

enter image description here

answered Jun 28, 2015 at 1:01

KingRider's user avatar

KingRiderKingRider

2,12025 silver badges23 bronze badges

Had the same problem.

My device was rooted and ROM’ed with an older version of Google Market which did not self-update.
You can verify your the Market/Play version by looking at it in the AppManager.

I actually decided to use another device, but I guess otherwise I would have to find a way to upgrade the Market/Play version.

answered Jul 2, 2013 at 10:07

Doigen's user avatar

DoigenDoigen

1892 silver badges6 bronze badges

I got this error from wiping the Google Play cache. You have to reopen the Google Play app and accept the terms before it is functional for IAB again.

answered Jul 9, 2014 at 15:02

Lee's user avatar

LeeLee

1,0282 gold badges11 silver badges18 bronze badges

This is because the account which is currently logged in the device is not registered in Google Developer Console.
TO resolve this problem,
1. Go to your Google Developer Consol
2. In Account Detail Tab, enter the email address(which is in device) in «Gmail accounts with testing access» and press the save button on the top.

Thats it.

answered Feb 22, 2014 at 14:16

Yasir Ali's user avatar

Yasir AliYasir Ali

1,7851 gold badge16 silver badges21 bronze badges

In my case I’ve set a different value for serviceIntent.setPackage(«com.android.vending»); from IabHelper. Make sure you leave it with this value

answered Jul 29, 2015 at 17:21

Alex's user avatar

AlexAlex

1911 silver badge10 bronze badges

I had that same error and then noticed my phone was in Airplane Mode! Once connectivity was restored, I was good to go.

answered Feb 7, 2016 at 1:02

Papasmile's user avatar

PapasmilePapasmile

6241 gold badge4 silver badges22 bronze badges

IabHelper.java

Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
serviceIntent.setPackage("com.android.vending");

It is an error if it is not possible to specify correctly the action and packageName to IInAppBillingService.aidl.

answered Feb 8, 2016 at 10:59

Hashido Tomoya's user avatar

Have come up with the solution.

Try the below 3 steps:

  1. Clear the cache of GooglePlay app and Google Play services app.
  2. Remove IInAppBillingService.aidl file.
  3. Copy the above file again from sdk folder and paste it to the aidl folder in my app.

This problem usually occurs when we copy the aidl file from one project to another project.

answered May 22, 2016 at 14:10

Ankur Yadav's user avatar

Solution 1:[1]

Try this ! Just go to IabHelper class, in startSetup method under onServiceConnected callback. you can see a Intent, Just replace with below code. (or just Find for BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE).

 Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
        serviceIntent.setPackage("com.android.vending");
        if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {
            // service available to handle that Intent
            mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
        }
        else {
            // no service available to handle that Intent
            if (listener != null) {
                listener.onIabSetupFinished(
                        new IabResult(BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE,
                                "Billing service unavailable on device."));
            }
        }

Solution 2:[2]

if you target android 31 put this in manifest :

<permission android:name="android.permission.QUERY_ALL_PACKAGES" />

<queries>
    <intent>
        <action android:name="android.intent.action.MAIN" />
    </intent>
</queries>

I built and android game which has a premium in app purchase, and I had it working fine for a while. (The game was in a beta testing branch, and users could purchase the premium upgrade fine.)

A few days ago I decided to rewrite the project, so I could clean up my code a bit. Everything seemed to work fine. (Play Game Services and AdMob Ads still work) However, in app billing no longer works. Every time my app start I receive an error: "Billing service unavailable on device. (response: 3:Billing Unavailable)" I’ve searched around everywhere, and found plenty of people having this issue, but none of their answers helped me.

I’ve tried:

  • Clearing the cache of the Google Play app, and accepting the terms by starting the app.
  • Trying multiple users on my phone. (All of which were added to the testers list in the developer console.)
  • Testing on at least 3 other (non-rooted) devices.
  • Double checking that the "com.android.vending.BILLING" permission is in my manifest file.
  • Using the same keystore to sign my new application.
  • Using the same exact namespace for my new project.
  • Trying 3 different play store versions.

Here is my iabHelper code.

String base64EncodedPublicKey = "KEY HERE";

iabHelper = new IabHelper(this, base64EncodedPublicKey);
iabHelper.enableDebugLogging(true);
iabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
    @Override
    public void onIabSetupFinished(IabResult result) {
        if (!result.isSuccess()) {
            Log.e(TAG, "Problem setting up in-app billing: " + result.getMessage());
            return;
        }

        if (iabHelper == null) return;

        iabHelper.queryInventoryAsync(new IabHelper.QueryInventoryFinishedListener() {
            @Override
            public void onQueryInventoryFinished(IabResult result, Inventory inv) {
                if (iabHelper == null) return;

                if (result.isFailure()) {
                    Log.e(TAG, "Failed to query inventory: " + result);
                    return;
                }

                Purchase premiumPurchase = inv.getPurchase("premium");
                isPremium = (premiumPurchase != null);

                if (!premium())
                    loadInterstitial();
           }
        });
    }
});

and my onActivityResult code

I’m pretty sure this isn’t done correctly, however I don’t think it’s relevant to this error. (This isn’t even called before I see the error while debugging.)

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.i(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);

    // Pass on the activity result to the helper for handling
    if (!iabHelper.handleActivityResult(requestCode, resultCode, data)) {
        if (resultCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED)
            gameHelper.disconnect();
        gameHelper.onActivityResult(requestCode, resultCode, data);
        super.onActivityResult(requestCode, resultCode, data);
    } else {
        Log.i(TAG, "onActivityResult handled by IABUtil.");
    }
}

I don’t normally like having to ask for help, as the answer is normally accessible online somewhere. However, I’ve been at this for a few days now, and I’ve already ripped out all the hair I have. Thanks for any help you can offer.

My best guess at the moment is that I forgot to copy something from the original project, which is causing it to fail, but I can’t think of anything besides the base64EncodedPublic key, my keystore, and the use of the same namespace. Am I missing something?

Понравилась статья? Поделить с друзьями:
  • Как найти мамины часы
  • Как найти отклонение доли в процентах
  • Как найти такие же фото в инстаграм
  • Как исправить свои ошибки в воспитании сына
  • Как найти одинокого мужчину молитва