—–Start of Advertisement——-
BUILD CAR POOL SOLUTIONS ON ANY DEVICE TO RUN ANYWHERE (www.mcruiseon.com). Introducing mCruiseOn, the java library /json api’s that you can use to build a car pool solution. Be the next avego.com, carpooling.com, zimride.com. mCruiseOn is your one stop API on EC2.
——End of Advertisement——-
I got this annoying exception when I tried to run the “In app billing” sample app. I followed all the required steps but kept getting this exception at load time.
I did the following
1) Setup a Market account
2) Renamed the package to not have
“android” or “example”
3) Added the public key from the market profile to Security.java
4) Built/Signed the app
5) Added “inapp products” to the market place
6) Uploaded as draft app
7) Uninstalled the sample on the device
8) Installed it on the device
9) Ensured that market place was > 2.3.5
10) Setup a test account. And this test account should not be the account registered for this developer. Else it can be a security issue (buying your own product).
When I load, I get this annoying exception. Absolutely no help on any website.
Finally after a few hours of pulling out some more of my hair, I finally think of a root cause. The main reason that its a security issue can be only because of the public key or the test account. Thats it, it was the test account.
Root Cause 1
My registered account (A) with market place was my primary account with all the app’s, contacts and my life in short. The test account was my other gmail account (B), which did not have any apps. So, catch 22.
If I setup (A) as my primary account on android phone (samsung, which does not take its updates from google android, buts its own builds), then I land up in a Security Exception since A cannot be used as a test account. And the primary account on the device is considered as the test account when the sample in app billing app runs.
If I setup (B) as my primary account on the android phone, market application is 2.1, and not enough for the sample app to run. So you see, catch 22.
Solution was simple. I registered B as my market account (one more cost to my budget :)). But google being really nice, refunded my fee’s for A.
Mind you A was a new account, no apps published on this account and nothing pending for payment. It was a brand new account.
Root Cause 2
The public key can change when google activates/cancels accounts. So just reverify the public key and your Security.java file.
Root Cause 3 (THE worst of the root causes)
The AIDL file is referred from your BillingService.java file. Also remember that we modified the package name to “not” contain android ? The BillingService is “INCORRECTLY” referring to the older package (com.android…..).
Now, how do I know this ? Well, details are in the fine print. On the “http://developer.android.com/guide/market/billing/billing_integrate.html” page its mentioned that if you need debugging information set DEBUG = true in Consts.java. I did that and found a warning , before the SecurityException in LogCat.
Set Debug=true in Consts.java
Hope you understood it. If not, please comment on the blog, I’ll respond.