As for my thesis work, I managed to iron all of the errors out of/fix the compatibility of the book's sample code yesterday. When I tried to build the app, I discovered that I would have to sign the app using a certificate file called a keystore before I was able to build it and push it to my phone over USB. I learned that Android applications can be signed in one of two modes - debug mode and release mode. Debug mode signatures use only a single private key that the developer holds for verification of the app's source. In other words, it's a symmetric-key encryption where there is only one key, and that key is just a password the developer sets. Signing apps in release mode is far more complicated. As I understand it, the Google Play Store makes a public key available to normal users and installers of the app, and the developer creates a set of private keys that are stored in a keystore file. Every time the developer releases a new version of the app, he makes a new set of private keys. When a user installs the app for the first time or updates to a newer version, the installer program checks the public key provided by the Google Play Store against the private keys in the keystore file in the app being installed to see if they match. If they do, then the app is installed as normal. If they don't, the installer flags the app as incorrectly signed, and doesn't install it.
This morning, after some messing around with my compiler and a few internet searches, I figured out that the password used by default for the debug keystore file included with the compiler was just "android". Once I put in that password, the compiler was able to sign my app without any errors. It then saved a .apk ("Android PacKage") file to my desktop. I connected my phone to my computer with a USB cable, opened my command line tools, and pushed the package to my phone. I was relieved to see that it both installed and ran without any hitches, despite the enormous gap in software versions. So that was it! Now that I know how to build and test Android apps, I can start learning how to make apps that actually do things.
P.S. - Even though (I think) I know how to get the source code examples for this one to work, I would like to be able to not worry about compatibility or outdatedness at all, so I will likely be ordering a current edition of this or another book over the holidays regardless.
No comments:
Post a Comment