Monday, December 31, 2012

signed .apk file and first in-app product

When I started my in-app billing testing with Android a little over a week ago, I got the test product working (android.test.purchased) and wanted to try my real products.  That led me to a long list of pre-requisites.  Before I could create an in-app product in the Google Developer Console, I first had to upload my .apk.  No problem, I thought.  I uploaded it and got an error that it was not "zip aligned".

Okay, so I did some reading and found the zipalign tool that you have to run on a .apk file before uploading. Fine, I ran the tool, uploaded again.  Now an error that my .apk is not signed.  Back to the documentation.

Before you can upload your .apk, it has to be complied in release mode and signed with a key.  All the documentation emphasizes doing this with command line tools, but it also can be done using a wizard in Eclipse.  You just right click on the project and choose Export.  The part about the keystore was still confusing to me, so I had to read  more about that.  After all the reading and trial and error that day, I basically gave up on it and worked on some other stuff.

But today I revisited it.  Reading about generating a keystore using the command line tools helped me to understand what was being asked for in the wizard in Eclipse.  I didn't get that it was asking me to create a new password-protected keystore file that then contains a separate key with its own password. So I finally got past that, got the .apk file signed, then zip aligned, and then uploaded it successfully to the Developer Console.  From there it was easy to make the first in-app product!

But now it's 5:30 on New Years Eve, so I'm calling it quits! Happy New Year!

No comments:

Post a Comment