Home > Resources > Development Tools > IDE Setup & Tools

Setting Up Your Development Environment

Introduction

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

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-ons 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 Optional SDK Add-Ons

In addition to using the APIs made available through the Amazon Mobile Apps SDK, the device-specific APIs are available to add functionality to your app for Fire Phone and Fire HDX 8.9 (4th Gen) tablets. To use these APIs, install the Fire Phone or Fire Tablets 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. To install the Fire Tablet add-on, expand Android version number 4.4.2, click SDK Platform, and then click Amazon Fire Tablet SDK Addon.
  10. Expand Extras and click Amazon Kindle Fire USB Driver. If you are developing for Fire Phone, also click Amazon Fire Phone Build Tools.
  11. Click Install n Packages.
  12. 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) or https://s3.amazonaws.com/android-sdk-manager/redist/Fire_Tablets.zip (Fire Tablets). 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 tablets and 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 Tablet SDK Add-on, add the following line to your build.gradle file:

    compileSdkVersion = "Amazon.com:Amazon Fire Tablet SDK Addon:19"

    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. To install the Fire Tablet add-on, expand Android version number 4.4.2, click SDK Platform, and then click Amazon Fire Tablet SDK Addon.
  4. Expand Extras and click Amazon Kindle Fire USB Driver. If you are developing for Fire Phone, also click Amazon Fire Phone Build Tools.
  5. Accept license agreements and install the packages.
  6. Set your project up in Eclipse and specify Amazon Fire Phone SDK in the Compile With drop-down.

Native Code Development (Optional)

Fire tablets and Fire phone support apps that include native code compiled with the Android NDK. The following table shows the NDK revision for compiling your native-code apps to take advantage of the features available on a Fire devices. For information about installing the NDK, in the Android documentation see Android NDK.

Note: 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.

Tablet Compile native-code apps with
Fire HDX 8.9 (4th Gen)
Fire HD 7 (4th Gen)
Fire HD 6 (4th Gen)

Android NDK Revision 9b or later
Fire Phone
Kindle Fire HDX 8.9" (3rd Gen)
Kindle Fire HDX 7" (3rd Gen)
Kindle Fire HD 7" (3rd Gen)

Android NDK Revision 8e or later
Kindle Fire HD 8.9" (2nd Gen)
Kindle Fire HD 7" (2nd Gen)
Kindle Fire 7" (2nd Gen)

Android NDK Revision 7 or later
Kindle Fire (1st Gen) Android NDK Revision 5 or later

Related Resources

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 Mobile App APIs: Use the Amazon Mobile App SDK to take advantage of powerful cross-platform APIs.