问题
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:
- I have the billing permission in the manifest.
- The billing service and receiver are defined in the manifest.
- My app is not published, I just have a draft up.
- I created a single in-app item, and published it.
- I have a test account added, but not sure that it makes a difference at this point.
- 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
回答1:
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.
回答2:
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.
回答3:
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.
来源:https://stackoverflow.com/questions/11513643/in-app-billing-cant-make-result-developer-error-go-away