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
- Step B. Set Up the JDK
- Step C: Install Android Studio and the Necessary Tools and SDKs
- Step D: Open the Sample App in Android Studio
- Troubleshooting Build Issues
- Next Steps
Step A: Download Fire App Builder
Due to differences in symbolic linking defaults in Git between Mac and Windows, instructions differ here by platform.
If you're on a Mac or Linux, download the code for Fire App Builder using one of the options below.
-
Download the code as a zip file. Go to https://github.com/amzn/fire-app-builder and click Code > Download ZIP.
OR
-
Clone the repository using the command line. 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
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.
- 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.
-
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.
- Download the code for Fire App Builder using one of the options below.
-
Download the code as a zip file. Go to https://github.com/amzn/fire-app-builder and click Code > Download ZIP.
OR
-
Clone the repository using the command line. 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
-
- 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:
- Open Terminal or a command prompt.
-
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. -
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:
- Mac: 10 JDK 8 Installation for OS X
- Windows: JDK Installation for Microsoft Windows. (Specifically, see "Running the JDK Installer" and "Updating the PATH Environment Variable.")
- For other operating systems and information, see JDK 8 and JRE 8 Installation Start Here.
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:
- Start Android Studio.
-
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.
-
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.
Note: The first time you open the project, it can take anywhere from 20-40 minutes for Gradle to build the project, depending on the assets Gradle needs to download as well as your network and processor speed. Subsequent times should take about a minute or less. While you're waiting, consider taking an app tour to become familiar with the app, and also consider exploring the Settings options on your Fire TV device.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).
-
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: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.)
Note: Unless otherwise specified, this documentation refers to locations of files using the Android view. Also, note that this documentation was last reviewed using Android Studio 3.1.2. Android Studio is continually evolving, so some drift may occur with Android Studio references.
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.
Last updated: Jan 04, 2022