MobileAndroidA Guide to Developing Apps for Kindle Fire

A Guide to Developing Apps for Kindle Fire

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Introduction

Amazon’s Kindle Fire (and its variants) marks the entry of Amazon into touch-enabled mobile computing devices. While the look and feel of the Kindle Fire tablet appears distinctly different from other mobile operating systems, it is actually Android in disguise. In fact, it is very compatible for existing Android applications, which is customized to remove native access to the Google app ecosystem.

The first gen Kindle Fire devices are based on Android Ice Cream Sandwich (API level 15) and the second gen Kindle Fire (Kindle Fire HD) devices are based on Android Jelly Bean (API level 17).

For developers, this implies that building applications targeting Amazon’s Kindle Fire is similar to building an Android application. In fact, per Amazon, most of the Android applications (76% of the applications they tested) can work on Kindle Fire without needing any change or development effort.

Amazon offers additional features – like In-App Purchasing, GameCircle and Mobile Ads to enable developers a richer customer experience and monetization opportunities.

System Requirements

Hardware Requirements

To get started with building applications, here are a few requisites.

  • Intel processor, which supports virtualization – To support Kindle Fire emulators, we need a PC with Intel processor that supports virtualization extensions (VT-x).
  • A PC  running Windows 7 ( or higher) or  MAC OS X 10.7
  • For Windows machines, a graphics card that supports DirectX 11 or higher.
  • 4 GB RAM, with 1.25 GB free to run the Kindle Fire emulator.

Software Requirements

To build applications for Kindle Fire, we mostly use the same tools as the Android building environment – Java SDK, and Eclipse. In addition, we would need the Kindle Fire emulators.

First, we need to install the Java SDK, which can be downloaded from

 http://www.oracle.com/technetwork/java/javase/downloads/index.html . Make sure you download the SDK that matches the bitness of your Operating system (32-bit or 64-bit).

Next, we need to install the Android SDK which is available from https://developer.android.com/sdk/index.html.

As with the Java SDK, ensure that the Android SDK matches the bitness of your operating system and Java SDK. Upon completion of the download, extract the contents of the ZIP file to a local folder. I recommend that you download to an easy-to-discover path like c:android.

After extraction, the folder will look like the screenshot below.

Local Android Folder
Local Android Folder

Next, start Eclipse by running eclipse.exe. Choose the location for your workspace and click OK.

Workspace Launcher
Workspace Launcher

Once Eclipse is launched, go to Windows -> Android SDK Manager.

Android SDK Manager
Android SDK Manager

The Android SDK Manager should launch. Navigate to Tools -> Manage Add-On Sites…

Manage Add-On Sites
Manage Add-On Sites

Navigate to the User Defined Sites tab.

User Defined Sites tab
User Defined Sites tab

Click “New…” to add a new entry.

When prompted for a URL, enter http://kindle-sdk.s3.amazonaws.com/addon.xml and click OK, and then Close.

Add Add-on Site URL
Add Add-on Site URL

The Android SDK manager will refresh the list of packages. After the refresh, select the following packages to install/update.

  • Tools
    • Android SDK Tools (if you do not have the latest version)
    • Android SDK Platform-tools (if you do not have the latest version)
  • Extras
    • Amazon AVD Launcher
    • Kindle Fire Device Definitions
    • Kindle Fire USB Driver
    • Android Support Library (if you do not have the latest version)
    • Google USB Driver (if you do not have the latest version)
    • Intel x86 Emulator Accelerator (HAXM)
  • Android 4.2.2 (API 17)
    • SDK Platform
    • ARM EABI v7a System Image
    • Intel x86 Atom System Image
    • Kindle Fire HD 7″ (3rd Generation)
    • Kindle Fire HDX 7″ (3rd Generation)
    • Kindle Fire HDX 8.9″ (3rd Generation)
  • Android 4.0.3 (API 15)
    • SDK Platform
    • ARM EABI v7a System Image
    • Intel x86 Atom System Image
    • Kindle Fire (2nd Generation)
    • Kindle Fire HD 7″
    • Kindle Fire HD 8.9″
  • Android 2.3.3 (API 10)
    • SDK Platform
    • Kindle Fire

Click “Install XX Updates”.

Click Accept License and Install.

Choose Packages to Install
Choose Packages to Install

This will install the necessary packages and prepare us to build applications for all generations of Kindle Fire.

Once the installation is complete, restart Eclipse.

Improving Your Development Environment Productivity

To help speed up things in your development environment, you need to enable virtualization extensions on your PC. This is typically a BIOS setting. Once you do this, you can install the Intel Hardware Acceleration Execution Manager. You will need to restart Eclipse after the installation to enable it.

You can download updated Windows emulator components from http://kindle-sdk.s3.amazonaws.com/qemu-updates.zip . Extract the emulator.exe, emulator-arm.exe and emulator-x86.exe to c:androidsdktools folder and restart Eclipse.

Working with the Kindle Fire Emulator

The next steps involve working with the Kindle Fire emulator.

Go to the command line and navigate to the Android SDK folder.

Now, navigate to the <android_sdk>/extras/amazon folder. If on Windows, go to AVDLauncherWindows directory. Execute amazonavd.

You will see a window titled Amazon AVD Launcher (similar to Android Virtual Device Manager).

Amazon AVD Launcher
Amazon AVD Launcher

Select a Kindle Fire Device and click “Create AVD”.

Create New Amazon AVD
Create New Amazon AVD

Click OK and your Kindle Fire virtual device is created.

Amazon AVD Launcher
Amazon AVD Launcher

Now, you can choose the Amazon AVD and click “Start…” to launch the emulator.

A window with launch options will pop up. Leave the defaults and click “Launch” to launch the emulator.

Launch Emulator
Launch Emulator

You can see the Kindle Fire OS is booting up.

Once booting is complete, you will see a home screen depending on the image you have launched.

Home Screen
Home Screen

Building for Kindle Fire is as simple as building an Android application.

Under Eclipse, Click File->Create New Android Application…

New Android Application
New Android Application

Let us name our demo app as testKindleHDApp.

Put the other settings as shown below.

New Android Settings
New Android Settings

Click Next.

New Android Application
New Android Application

Leave the defaults and click Next.

Configure Launcher Icon
Configure Launcher Icon

Leave the defaults and click Next.

Create Activity
Create Activity

Click Next.

Blank Activity
Blank Activity

Click Finish.

We now have a very basic Android application.

The MainActivity.java listing is shown below.

package com.example.testkindlehdapp;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}

Now, we will run this on the Kindle Fire emulator.

Click Run -> Run.

Run As
Run As

Select Android Application and click OK.

Our application will compile and deploy on the emulator. Once installed, it will launch.

Demo App
Demo App

We can see our demo application running on the Kindle Fire emulator.

Summary

In this article, we learned about how to get the development environment setup for building applications for Kindle Fire. I hope you have found the information useful.

About the Author

Vipul Patel is a Program Manager currently working at a large online corporation. He has formerly worked at Microsoft in the Lync team and in the .NET team (in the Base Class libraries and the Debugging and Profiling team). He can be reached at vipul.patel@hotmail.com

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories