2013年1月6日日曜日

Connecting Your Kindle Fire to ADB

Introduction

Once you've created your app for Kindle Fire, you can connect your computer to your Kindle Fire tablet using a USB cable, and then copy the app and complete final performance testing and USB debugging on the device.

To copy your app and use USB debugging, you must first connect your Kindle Fire tablet to the Android Debug Bridge (ADB). The ADB is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device.

This article provides detailed instructions on how to connect your Kindle Fire tablet to ADB on computers running either Windows 7 or Mac OS X.


Prerequisites

To connect your device to ADB, you must have at least one of the Kindle Fire emulators, technically called a Kindle SDK add-on, installed on your machine. If you are running Windows, you must also have the Kindle Fire USB driver installed.

For more information and instructions on using ADB, see Android Debug Bridge.

Windows users only: If you previously connected your device to your computer without first enabling ADB, you will need to force a re-installation of the driver. See the Known Issues section for instructions on how to remove and re-install the device driver.


Set Up Your Environment

  • To download the Android SDK and install the Kindle SDK add-ons, see the Setting Up Your Development Environment article for step-by-step instructions.

    If you have already followed these instructions, you can skip ahead to the Connect Your Kindle Fire section.

  • If you have not yet installed the Kindle SDK add-ons, but have already downloaded the Android SDK, do the following:

    Note: Windows 7 users must have administrator rights.

    1. Start the Android SDK Manager.
    2. Follow the Installing the Android SDK instructions, starting at step 4, to install the required SDK packages.

      Note: If you complete the installation of the SDK packages by launching the Android SDK Manager from Eclipse, you will need to close and restart Eclipse before continuing to ensure that the newly installed packages refresh across the full environment.


Connect Your Kindle Fire

To connect your Kindle Fire to ADB, you must first enable ADB on your device, and then complete the setup steps for your platform.

  1. On your device, go to Settings.
    Note: This does not apply to Kindle Fire (1st Generation), which has ADB enabled by default.
  2. Under Security, turn Enable ADB to On, and then click OK in the pop-up warning message.
    Note: As a security precaution, we recommend turning Enable ADB to Off when you are not trying to connect to the device with ADB.

Platform-Specific Setup Steps

Once you've set up your environment and enabled your device, you can complete the following steps for your platform to connect your device to ADB.

  • WINDOWS 7 SETUP

    1. In <ANDROID_SDK>\extras\amazon\kindle_fire_usb_driver, run the Kindle Fire ADB drivers.exe, and then follow the instructions on the screen.
    2. Connect your Kindle Fire tablet to your computer's USB port using the USB cable.

    To confirm the device has been installed, from Start, click Control Panel, and then select Device Manager. In Device Manager, under Kindle Fire, the device will be included as Android Composite ADB Interface.

    Restart the ADB server, as detailed below, and confirm that the unique ID (serial number) for your Kindle Fire tablet is detected. After running the adb devices command, it will be listed under List of devices attached.

    1. Open a command window.
    2. Go to your Android SDK platform tools folder; a typical install location is <ANDROID_SDK>\platform-tools\.
    3. Run the following commands, and then confirm that the unique ID number for your Kindle Fire tablet is in the device list.
      1
      2
      3
      adb kill-server
      adb start-server
      adb devices
    4. If the device is not being listed after issuing adb devices, run the following command and then repeat step 3.
      1
      android update adb

    Note: If your Kindle Fire is not being detected, you may need to reboot your computer or log out and log in for the changes to take effect.

  • MAC OS X SETUP

    1. Connect your Kindle Fire tablet to your computer's USB port using the USB cable.
    2. Update ADB.

      1. Open a terminal shell and navigate to <ANDROID_SDK>/tools/.
      2. Run the following command to modify your adb_usb.ini file.

        1
        android update adb
    3. Restart the ADB server, as detailed below, and confirm that the unique ID (serial number) for your Kindle Fire tablet is detected.

      1. Open a terminal shell and navigate to <ANDROID_SDK>/platform-tools/.
      2. Run the following commands, and then confirm that the unique ID number for your Kindle Fire tablet is in the device list.
        1
        2
        3
        ./adb kill-server
        ./adb start-server
        ./adb devices

    Note: If your Kindle Fire is not being detected, you may need to reboot your computer or log out and log in for the changes to take effect.


Install an App to Your Kindle Tablet

Now that your Kindle Fire is connected, you can install a Kindle Fire app to your Kindle tablet.

  1. Open a command window (PC) or terminal shell (Mac).
  2. From the command line, go to your Android SDK platform tools folder; a typical install location is <ANDROID_SDK>\platform-tools\.
  3. Run:
    1
    adb devices
    and confirm the unique ID for your Kindle Fire tablet is in the device list.
  4. Do one of the following:

    • To install your Kindle Fire project from Eclipse, press CTRL+F11.
    • To install your project from the command line, run:
      1
      adb install <path to your APK file>

Your project will be installed to your Kindle Fire tablet. To confirm, disconnect your Kindle Fire tablet.

Note: When apps are side loaded onto a Kindle Fire tablet, the icons are loaded from the APK or use the Android defaults if none are present. Apps installed from the store will use the icons you uploaded during the app ingestion process.

To uninstall an app from your Kindle Fire, tap and hold the app, and then select Remove from Device.


Copy a File to the Root Directory

There may be times when you will need to copy files to the "root" directory of the Emulator.

For example, for In-App Purchasing (IAP) testing, you must place amazon.sdktester.json in the root directory of the device.

There are two ways to copy (push) files to the root directory of a Kindle Fire device or a Kindle Fire emulator.

  • From Eclipse:

    1. From the Window menu, select Open Perspective, click Other, click DDMS, and then click OK.
    2. On the Devices tab, select the Emulator.

      Note: If the Emulator is running but not listed, do the following: On the Devices tab, click the View Menu button, and then click Reset adb.
    3. On the File Explorer tab, expand the mnt folder, select the sdcard folder, and then click the Push a file onto the device button .
  • From the command line, run:
    1
    adb push <file on local machine> /mnt/sdcard

For the IAP example noted above, to copy a file to the root directory of a Kindle Fire device or emulator, you would run one of the following.

  • Windows:
    1
    adb push "C:\Users\<your-login>\My Documents\amazon.sdktester.json" /mnt/sdcard
    (Note: You must use quotes around the Windows file location if there is a space anywhere in the path.)
  • Mac:
    1
    adb push /Users/<your-login>/Documents/amazon.sdktester.json /mnt/sdcard/

Known Issues

Windows users only: If you previously connected your Kindle Fire device to your computer without first enabling ADB, your device may not be detected by ADB. Complete the following steps to force a re-installation of the Kindle Fire device driver.

  1. Connect your Kindle Fire to your computer's USB port using the USB cable.
  2. From the Start menu, right-click Computer and select Manage.
  3. In the left pane, under Computer Management, expand System Tools, and click Device Manager.
  4. In the right pane, locate and expand Other devices.
  5. Right-click the device name Kindle and click Properties.
  6. In the Kindle Properties window, on the Driver tab, click Uninstall, then Confirm, and then unplug your device from your computer.
  7. Follow the instructions in this article to connect your device to ADB.

0 件のコメント:

コメントを投稿