Shapejam

Trying to follow Buckminster Fuller's example in life, one step at a time to bring you brain scrapings for a new millennium.

Installing Google Play on your Amazon Fire Tablet

07 Dec 2018 - Nic Ho Chee

I've been looking for a nice, cheap tablet which I could use in kiosk mode, and give out at Comic Cons to folks who might be interested in the Bedtime Comics biweekly comics newsletter. With GDPR now in place, users need to be able to opt into mailing lists and have much more granular control over how they can be contacted. Paper and pencil signup sheets don't really cut it any more, and an app running on a tablet will make sign-up cleaner, more readable, and legal should you use someone like Mailchimp's GDPR compliant webforms correctly. The Amazon Fire looked like the perfect device for this, both cheap, sturdy, and basically running Android. It turns out that it doesn't have support for the Google Play store out of the box, which I needed to install the required kiosk software... but you can get it running if you want it.

These steps outline how I managed to get the Google Play Store running on the Amazon Fire, using an Apple Mac...

  1. Install Android Studio. This is required to run the tool, adb, which allows various apks to be patched on the Amazon Fire.
  2. The APKs needed are available across the web on various sites, but I wouldn't trust an APK from a 3rd party site. Google allows the download of official Google Android images for a variety of phones. The required APKs can be sourced from these. The latest Amazon Fire 8 HD is compatible with Android 7.1.1/7.1.2, so 7.1.1 (NOF27D, Apr 2017) or newer works.
  3. Essentially, you extract the system image, mount the image and dig through it to find the various APKs required. This blog post outlines everything you need to know to achieve this. OSXFuse, ext4fuse and ImgTool were needed. Luckily there are links to code repos which allow all the tools to be compiled from source as required.
  4. Download and build imgtool. It has a makefile with a "make all" configuration. I found twelve warnings, but the tool works.
  5. Poke through your nexus image and find the system.img file... then extract in terminal with:
    ~/Applications/imgtool/imgtool system.img extract
  6. You should have a subfolder called extracted which contains a large image.img file. It takes a while to create this, after which you can mount it with the command below (assuming you don't already have another Linux volume on your macbook/mac...):
    sudo ext4fuse extracted/image.img /Volumes/Linux -o allow_other
  7. You can cd into the new readonly Linux volume you've created, and you need to find the following apks
    com.google.android.gsf.login        system/priv-app/GoogleLoginService/GoogleLoginService.apk
    com.google.android.gsf              system/priv-app/GoogleServicesFrameWork/GoogleServicesFramework.apk
    com.google.android.gms              system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk
    com.google.android.phonesky         system/priv-app/Phonesky/Phonesky.apk
  8. Connect your Amazon Fire via USB, and open a new terminal so that you can turn on logging for the device. I managed to catch myself trying to install PhoneSky.apk rather than Phonesky.apk... case-sensitivity FTW! In the new terminal start logcat (assuming you've installed Android Studio to its default location.)
    ~/Library/Android/sdk/platform-tools/adb logcat
  9. In your main terminal, add the trace variable and check your environment to make sure it is set.
    export ADB_TRACE=adb
    printenv
  10. Check the list of packages to get a feel for what has been installed already.
    ~/Library/Android/sdk/platform-tools/adb shell pm list packages -f
  11. Install the following APKs using adb.
    ~/Library/Android/sdk/platform-tools/adb install system/priv-app/GoogleLoginService/GoogleLoginService.apk
    ~/Library/Android/sdk/platform-tools/adb install system/priv-app/GoogleServicesFrameWork/GoogleServicesFramework.apk
    ~/Library/Android/sdk/platform-tools/adb install system/priv-app/Phonesky/Phonesky.apk
    ~/Library/Android/sdk/platform-tools/adb install system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk
  12. I put Chrome on there too as a test to check that the installation path was working.
    ~/Library/Android/sdk/platform-tools/adb install system/app/Chrome/Chrome.apk
  13. Turn your device off and on again to get the new tiles for the Google Play Store and Chrome.
  14. Unmount the Linux volume added previously. My command line was...
    diskutil unmount /Volumes/Linux

This enabled me to install my Kiosk software of choice, and with various Child Mode settings on, it works well as a newsletter signup device.