In-app billing, can't make RESULT_DEVELOPER_ER

2019-02-24 13:10发布

I'm trying to get in-app billing working on android, but keep getting the following logcat output upon trying to initialize transactions:

// from logcat, BillingService:
Billing service connected
CheckBillingSupported
CheckBillingSupported response code: RESULT_OK
RestoreTransactions 
   restoreTransactions received RESULT_OK
     request id: 12345
     request id: -1
handleCommand() action: [com.android.vending.billing.RESPONSE_CODE].
RestoreTransactions: RESULT_DEVELOPER_ERROR

My setup:

  1. I have the billing permission in the manifest.
  2. The billing service and receiver are defined in the manifest.
  3. My app is not published, I just have a draft up.
  4. I created a single in-app item, and published it.
  5. I have a test account added, but not sure that it makes a difference at this point.
  6. Both the draft apk in marketplace, and the apk on my phone are signed in release mode with the same key and have the same versionCode.

I've gotten in-app purchases to work in another app, but in that case I already had a version of the app published. In this case (as mentioned in #3), I've never published the apk once. Do we have to publish the app once for this to work? I'd assume not,

Thanks

3条回答
家丑人穷心不美
2楼-- · 2019-02-24 13:47

Another reason you may get this error is if you attempt to fetch more than 20 SKUs at a time. This limit is documented in the AIDL file.

查看更多
劳资没心,怎么记你
3楼-- · 2019-02-24 13:58

You don't need to have the app published on Google Play, a draft is enough.

The 6 points you've mentioned are ok but I guess you need to check extra requirements as mentioned in the doc:

RESULT_DEVELOPER_ERROR:

Indicates that an application is trying to make an in-app billing request but the application has not declared the com.android.vending.BILLING permission in its manifest. Can also indicate that an application is not properly signed, or that you sent a malformed request, such as a request with missing Bundle keys or a request that uses an unrecognized request type.

查看更多
\"骚年 ilove
4楼-- · 2019-02-24 14:02

It looks like you have followed all the requirements in the doc, so I think the solution would be to simply wait until the Google Play servers catch up.

I had the same problem when I tried to restore transactions shortly after uploading a new version of the apk for the app to Google Play. It seems that it takes some time (maybe several hours) for the new apk to be fully processed on the Google Server so that it responds correctly to all types of billing requests. For example, I was getting RESULT_OK in response to CHECK_BILLING_SUPPORTED without having to wait too long, but had problems (RESULT_DEVELOPER_ERROR as an asynchronous response) with RESTORE_TRANSACTIONS. But when I tried again in a few hours with the same version of the apk, I got RESULT_OK in response to RESTORE_TRANSACTIONS as well, without making any changes to the code.

查看更多
登录 后发表回答