How to Edit an Android APK

2013-04-26 09:47 - Programming

I've got a small handful of Android apps where I prefer something older than the latest version. Some change was added that I don't like. But the Play Store has a tendency to auto-update, and then I no longer have the old version I prefer. I do this rarely enough that I can't memorize the steps, but often enough that it's annoying to go look them up again. So here they are. You'll need apktool. Plus keytool and jarsigner, which just happened to be installed for me already (in Ubuntu).

$ apktool d WhateverApp.apk
# Now edit some files, especially "versionCode" in AndroidManifest.xml.
# I like to change app_name in res/values/strings.xml just a little bit too.
$ apktool b WhateverApp/
# First time only:
$ keytool -genkey -keystore $USER.keystore -validity 10000 -alias $USER
$ jarsigner -keystore $USER.keystore -verbose "WhateverApp/dist/WhateverApp.apk" $USER

Voila! If you set versionCode high enough, you've got an old app's APK which you can side load, and the Play Store will never overwrite.


No comments!

Post a comment:

  If you do not have an account to log in to yet, register your own account. You will not enter any personal info and need not supply an email address.

You may use Markdown syntax in the comment, but no HTML. Hints:

If you are attempting to contact me, ask me a question, etc, please send me a message through the contact form rather than posting a comment here. Thank you. (If you post a comment anyway when it should be a message to me, I'll probably just delete your comment. I don't like clutter.)