Saturday, November 28, 2015

Step by Step Guide to Rooting Amazon Fire Phone and Getting Google Apps

Recently I bought Fire phone almost for free with a year of prime membership. Its has some nice hardware features but its Fire OS has some downside like absence of Google Play Store. Here is how to make some useful changes to make Fire Phone more useful.

Backup all data before you start. There is 100% chances for wiping out all kind of settings and data etc.

Download following things before starting:
Put all these files in one folder.
To install adb binary in Ubuntu without downloading android tools use the command:

sudo apt-get install android-tools-adb

Otherwise get Android Tools to run commands such as adb or standalone adb binary from somewhere else if not installed already

0. Copy Safestrap and KingRoot apk's into phone storage. In Settings -> Device -> Get info about your phone. Click multiple time on Model Number to activate Developer Options. Do it all the time. Some notification pops up, accept it.

1. Install some nice file manager like ES File Explorer etc from amazon app store or from apk directly.

2. Install KingRoot and run. Follow onscreen instructions to root Fire phone. Fast Internet connection required for KingRoot to root.

Apk's are easier to install via adb command like this

adb install some.apk

3. Install the Safestrap and open it. Follow onscreen instructions to Install it. Safestrap will ask for root permission so allow it.

4. After Install Recovery click on Reboot to Recovery.

5.  Inside Recovery click Advanced.

6. Inside Advanced click ADB Sideload.

7. Swipe to Start Sideload. Better tick to Wipe Dalvik Cache and Wipe Cache.

8. Sideload the Amazon Fire Phone latest ".bin" file now like this command. Make appropriate changes to file name that you downloaded according to your phone version.

adb sideload update-kindle-

9. After successful side-load "DO NOT REBOOT" instead again go back and choose sideload option again.

10. This time sideload super-su zip like this. Again change the file name.

adb sideload

11. Now choose to Reboot System.

12. Finish the first time start-up wizard process.

13. This time superSU should be your root management app instead of KingRoot.

14. Again install the File Manager. Install the Safetrap apk again and install recovery. Reboot to Recovery. just like in step 3 and 4.

15. Again in recovery go to Advanced -> ADB-sideload like step 5,6,7.

This time sideload Google apps using following commands. Please change the zip file name to what you downloaded earlier.

 adb sideload

16. Reboot to system.

17. Go to ES File Manager and give it Root privileges.

18. Grant Root Privileges.

19. Swipe left and Choose System Apps.

20. Search for a System App named 'setupwizard'. There should be two apps with this name. Uninstall the app that has the package name ''. Otherwise it will bother next time the Fire Phone is factory reset.

21. Now Go to play store and login. Phone is like any other android phone with 3D features. Custom ROM can be installed using recovery but custom ROM does not support many hardware features like 3D, Camera etc.

22. Now Google Play store will not be removed even after a factory reset from settings.

23 To update Google apps simply download The Open Gapps latest package again and sideload it as in step 15 to 21.


1. If anything go wrong than one can go to Fire System Recovery using holding together Power Key and Volume UP button while the phone is switched off. Choose apply update from ADB. Sideload the Fire Phone Software binary using adb following command. Better wipe cache partition first.

adb sideload update-kindle-

This should factory reset Fire Phone.

2. If having some issues because of old data than go back to Safestrap app and Reboot to recovery and wipe the DATA partition.

3. To install Safestrap and run it using command line.
adb install Safestrap-Kodiak-4.0.1-B01.apk

To run Safestrap from command line using adb shell.

adb shell am start -n com.hashcode.safestrap/com.hashcode.safestrap.ics.SafestrapActivity

Wednesday, July 1, 2015

Managing Java KeyStore (JKS) for Android

What is a Java KeyStore : A Java KeyStore (JKS) is a repository of security certificates.

Basically a Java KeyStore is kind of a container for the public-private key pair or security certificates.

So when I started experimenting with Android Apps, I created multiple keystores and than managing each key-store gets difficult. Passwords for keystores and than again another password for the keys stored in it.

There is an easy way to fix it. The way is to merge all the keystores into one. There is no direct merge but its easy to export the key form the keystores and than importing all the keys into one keystore.

There is way to do all this via command line but there is an easy GUI way. KeyStore Explorer is a platform independent tool that allows the keystores to be merged easily.

KeyStore Explorer might ask you to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files if they are not installed already.

After installing simply open the source keystores and export all key-pair from that keystore, its easy and than in the end open the destination keystore to import all the exported key pairs in it.

With this tool one can easily allow to change the alias of android signing keys.

KeyStore Explorer also allow easy GUI way to change passwords for the keys and keystore.

There is no issue in importing keys from totally different developer and than using that to sign android apps. I personally imported a key from a different developer in my keystore and Google Play Developer Console gave me no issues while uploading new APK. After all its the key that differentiate the different developers not the keystore itself.

Now I have all my keys in one keystore and its very convenient to sign apps.