Home > Resources > Development Tools > IDE Setup & Tools

Setting Up Your Development Environment for Fire Phone

Introduction

To start developing apps for the Fire phone, set up your development environment by configuring the Gradle plugin and installing the optional Fire Phone SDK add-on.

Note: Certain development tools referenced in this document are provided by third parties, not by Amazon. Any links to these tools in this document take you to third-party sites to download and install them.  

Setting up Android Studio

See Getting Started with Android Studio for information about setting up the Android Studio development environment. If you have an existing installation of Android Studio or the Android Gradle Plugin, refer to Android Tools Version Compatibility to ensure that they are compatible.

Note: Versions of Android SDK Manager prior to version 23.0.0 are unable to recognize the latest Amazon SDK add-on or extras. SDK Manager comes packaged with Android SDK Tools and shares the same version number. Install the latest version of Android SDK Tools to ensure that you have the latest version of Android SDK Manager.

Installing the Optional SDK Add-On

In addition to using the APIs made available through the Amazon Mobile Apps SDK, several device-specific APIs are available to add functionality to your app for Fire Phone. To use these APIs, install the Fire Phone SDK add-on.

Take the following steps in the Android Studio IDE to install the SDK add-ons.

  1. In Android Studio, on the Tools menu, under Android click SDK Manager. - or - On the command line, run the following command, where <ANDROID_SDK> is the path to your Android SDK:
    <ANDROID_SDK>/tools/android
    
  2. In the Android SDK Manager window, verify that SDK Path points to the path to your Android SDK. To modify the path, in Android Studio, on the File menu, click Project Structure, and then update the Android SDK Location.
  3. In the Android SDK Manager window, from the Tools menu, click Manage Add-on Sites.
  4. In the Add-on Sites dialog box, click the User Defined Sites tab, and then click New.
  5. In the Add Add-on Site URLdialog box, enter the following URL:
    https://s3.amazonaws.com/android-sdk-manager/redist/addon.xml
    
  6. Click OK and then Close. Wait for the Android SDK Manager to refresh, as indicated by the progress bar.
  7. Expand Tools and click Android SDK Tools (latest version), Android SDK Platform-tools (latest version), and Android SDK Build-tools (latest version).
  8. To install the Fire Phone add-on, expand Android version number 4.2.2, click SDK Platform, and then click Amazon Fire Phone SDK Addon.
  9. Expand Extras and click Amazon Kindle Fire USB Driver. If you are developing for Fire Phone, also click Amazon Fire Phone Build Tools.
  10. Click Install n Packages.
  11. In the Choose Packages to Install dialog box, accept the license agreements for the packages, and then click Install.

Note: If you want to download the contents of the SDK without installing the add-on through your IDE, you can get the zip archives at https://s3.amazonaws.com/android-sdk-manager/redist/Fire_Phone.zip (Fire Phone). By downloading our SDKs, you agree to our Program Materials License Agreement.

Using the Android Gradle Plugin

Amazon supports using the Gradle build system to build projects for Fire phone. For information about the Gradle plugin, see the Gradle Plugin User Guide. A list of supported versions of the Gradle plugin can be found here.

Note: The Amazon version of the Gradle plugin is compatible with the standard version, and can safely be used in place of the standard version of the plugin.

Amazon Gradle vs. Standard Gradle

The Amazon version of the Gradle plugin differs from the standard plugin because it adds support for compiling with SDK addon resources. Additionally, the Amazon version of the Gradle plugin fixes known Android issue 75407 with the standard version of the Gradle plugin where the $ANDROID_SERIAL property is ignored causing tests to run on all connected devices. The Amazon version of the plugin acknowledges the $ANDROID_SERIAL property and only runs tests on the appropriate device. If the property is not set, tests will be executed on all connected devices.

Specifying the Amazon Version of the Gradle Plugin

To use the Amazon version of the Gradle plugin, you must update the build.gradle file for your project.

  1. In the build.gradle file for your project, in the classpath, replace android with amazon.device as shown in the following example:
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.amazon.device.tools.build:gradle:1.0.+'
        }
    }
  2. To build against the Fire Phone SDK Add-on, add the following line to your build.gradle file:
    compileSdkVersion = "Amazon.com:Amazon Fire Phone SDK Addon:17"

A full build.gradle file might look like this :

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.amazon.device.tools.build:gradle:1.0.+'
    }
}

apply plugin: 'android'

android {
    compileSdkVersion "Amazon.com:Amazon Fire Phone SDK Addon:17"
    buildToolsVersion "21.1.2"
    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 17
    }
} 

Using the Eclipse IDE

Note: Applications that need to compile with Amazon XML resources are not supported in Eclipse, and require use of the Gradle plugin.

  1. Open the Android SDK Manager and add the following user-defined site, in the Manage Add-on Sites dialog: https://s3.amazonaws.com/android-sdk-manager/redist/addon.xml
  2. To install the Fire Phone add-on, expand Android version number 4.2.2, click SDK Platform, and then click Amazon Fire Phone SDK Addon.
  3. Expand Extras and click Amazon Kindle Fire USB Driver. If you are developing for Fire Phone, also click Amazon Fire Phone Build Tools.
  4. Accept license agreements and install the packages.
  5. Set your project up in Eclipse and specify Amazon Fire Phone SDK in the Compile With drop-down.

Native Code Development (Optional)

The Fire phone supports apps that include native code compiled with the Android NDK.  The Fire phone SDK includes a native code API that allows you to use the Fire phone's Head Tracking capabilities in your app. See Using Native Code for Head Tracking on Fire Phone for more information. For your Fire phone apps compile your native-code apps using Android NDK Revision 8e or later.

Related Resources

Setting Up Your Development Environment for Fire Tablets: Set up and configure your development environment for developing apps for Fire tablets.

Using the Fire Tablet SDK: Use the Fire Tablet SDK to add Firefly, Maps, and Device Messaging functionality to your app for Fire tablets.

Using the Fire Phone SDK: Use the Fire Phone SDK to take advantage of unique Fire phone techology.

Amazon APIs: Use the Amazon Apps & Games Services SDK to take advantage of powerful cross-platform APIs.