Ti ringraziamo per la visita. Questa pagina è per il momento disponibile solo in inglese.

Download Fire App Builder and Build an App

To get set up with Fire App Builder, download the project from GitHub, make sure you have the Java JDK and Android Studio installed, and then open the sample "Application" directory.

Step A: Download Fire App Builder

Due to differences in symbolic linking defaults in Git between Mac and Windows, instructions differ here by platform.

Mac
  1. If you're on a Mac or Linux, go to https://github.com/amzn/fire-app-builder and click Clone or download. Copy the clone URL.
  2. In a terminal, browse to the directory you want, and then run the git clone command to download the files:

    git clone https://github.com/amzn/fire-app-builder.git
    
Windows

If you're on Windows, before you clone the Fire App Builder repository, you have symbolic linking set as true in your git settings. Otherwise, you may run issues building the project.

  1. Check whether you have admin privileges on your computer (by going to Start > Control Panel > User Accounts > Manage User Accounts). If you don't have admin privileges, it's okay. You can run a later script to fix any issues.
  2. If you do have administrative privileges, open your command line terminal as an administrator and run the following to configure git to allow symlinks:

    git config -–global core.symlinks true
    

    When you run this command, git config will be set to enable symlinks. All Linux symlinks will be converted to Windows symlinks during git clone.

  3. Go to https://github.com/amzn/fire-app-builder and click Clone or download. Then copy the clone URL.
  4. In a terminal, browse to the directory you want, and then run the git clone command to download the files:

    git clone https://github.com/amzn/fire-app-builder.git
    
  5. If you didn't have administrative permissions to run git config –global core.symlinks true before cloning or downloading the repo, run the scripts explained in Configure Symlinks for Windows Without Admin Privileges.

Step B. Set Up the JDK

You need the 1.8 version of Java Development Kit (JDK) or greater from Oracle. The JDK is used to compile Java apps on your machine. First, check to see if you already have the JDK:

  1. Open Terminal or a command prompt.
  2. Type java -version. If you have the JDK, the response should be something like this:

    java version "1.8.0_121"
    Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode
    

    On Windows you can also manually look in a directory such as C:\Program Files\Java\jdk1.8.0\ to see if the JDK is there.

  3. If you don't have the JDK, download the appropriate version of the JDK Installer for your machine from Java SE Development Kit Downloads and run it. For more details, see the following:

Step C: Install Android Studio and the Necessary Tools and SDKs

To work with Fire App Builder, you need to install Android Studio, the official IDE for Android projects.

See Getting Started with Android Studio and Install Android Studio for information about setting up the Android Studio development environment on your machine.

Fire App Builder requires you to have certain SDK tools and APIs installed with Android Studio. Selecting these tools from the Standalone SDK Manager ahead of time isn't necessary. When you open the Fire App Builder project (as described in the next section, Open the Sample App), Android Studio will prompt you to install any build tools or APIs that you're missing.

Step D: Open the Sample App in Android Studio

Open the "Application" project from Fire App Builder in Android Studio and build the app:

  1. Start Android Studio.
  2. At the Welcome screen, click Open an existing Android Studio project.

    If you don't see this welcome screen with these specific options, you probably haven't configured Android Studio with the JDK or any Android SDKs.

  3. Browse to the directory where you downloaded the fire-app-builder GitHub project. Inside the Fire App Builder project folder, select the Application folder, and then click Open.

    Gradle starts building the project.

    Depending on the latest release of Gradle, you may be prompted to update Gradle. If prompted, click Don't remind me again for this project.

    If Android Studio is missing any needed libraries or files, you might see messages such as the following:

    Or you may see the following in the Gradle Console:

    Or this:

    If you see these messages, click these links to install the missing tools. Simply keep opening the project and installing any missing tools as prompted until Android Studio no longer complains.

    If you run into build failures, you can try cleaning and rebuilding the project (Build > Clean Project or Build > Rebuild Project).

  4. Open the Gradle Console by clicking the Build button in Android Studio's footer so you can monitor the progress of the Gradle Build. This will let you know if the build succeeds or if Android Studio requires other downloads. Wait until Gradle finishes building.

    When the build finishes, you should see a message in the Gradle Console that says Gradle build finished. When Gradle finishes building the project, Android Studio will show the following directories in the Android view:

    Android Studio directories

    When Android opens the project, by default the Android view is shown (circled in red in the previous screenshot), and the "Application" folder is simply referred to as "app." The Android view flattens the project's files and displays the most commonly used files into a more usable arrangement, but the actual structure of the files differs on your computer disk. (The "Project" view will show you the actual arrangement of all the folders and files.)

Troubleshooting Build Issues

If you try to build the project but get an error that says:

Error: Content is not allowed in prolog

This error is related to Windows. When you cloned the Github repo, git didn't have symbolic linking configured to true. As a result, the symlinks used for some of the XML files didn't copy down with the right content.

To fix the issue, you need to configure git to use symbolic links:

git config –global core.symlinks true

Then re-clone the repo and build the project again. You can verify that symlinks are working by looking at the strings.xml file in Utils > src > main > res > values > strings.xml > strings.xml (en-rUS). If you see normal content, symlinks are working. In contrast, if there's just a short reference and nothing else, symlinks aren't working.

If you don't have permissions to configure symlinks, see Configure Symlinks for Windows Without Admin Privileges.

Next Steps

Go to the next step, Connect to Fire TV Through adb. In this next step, you'll connect to a Fire TV device and run the app on the device.