PKA provides some easy commands to extract, modify and reinstall APKs on your Android device. After running pka extract package name, edit the contents of apk_contents/smali to modify your APK, and then run pka install to reinstall the APK, signing it with your own testing certificate.
- a rooted Android device
- apktool, visible in your PATH
- the Android SDK, all tools installed in your PATH
- Copy the pka directory to somewhere safe.
- Edit pka, and set PKA_HOME to the directory it's installed in.
- Add a symlink to the pka script from a PATH directory. You do have a ~/bin, right?
- Run 'pka' with the following commands in a clean directory to perform some APK surgery.
- (Make sure you generate a keystore before you run pka install!)
Generate your keystore. This is needed in order to install your modified APK.
Display APKs currently installed on the device.
Extract the named APK from the device, and unpackage it in preparation for modification.
Install your currently modified APK to the device.
Install your currently modified APK to the device, using a version of smali in your PATH to assemble the DEX bytecode, instead of apktool's smali.
Based on the information in the provided info file, add Debug.startMethodTracing() and Debug.stopMethodTracing() calls to your APK. After running, 'getmprof' can be used to retrieve and read the generated profile information.
Based on the information in the provided info file, add counters to a target method to get BB statistics about the method. After running, 'getbbprof' can be used to retrieve and read the generated profile information.
Based on the information in the provided info file, add calls to Log.i() to print out the value of a given variable to logcat during app execution.
Download and view the profiling information generated by addmprof.
View the profiling information generated by addmprof, that has already been downloaded.
Download and view the profiling information generated by addbbprof.
View the profiling information generated by addbbprof, that has already been downloaded.
Reset your APK's contents to those found when the APK was first extracted from the device.
Backup the current APK's contents under the provided name.
Retrieve an APK's contents that were backed up under the provided name.
Cleanup the current directory of any extracted APKs. Doesn't destroy backups.
Deletes your backups as well.
Basically a clean, followed by cleanbackups.