Intro: How to Properly Set Up Android Studio and ZTE Speed Phone for FTC Robotics
As of the 2015-16 FTC Robotics season a new control system has been adopted for competition. This system uses Android devices powered by QualComm Snapdragon processors. This change in the control system has also created a big change in how these robots are being programmed. This document will explain how to set up the Android Studio Integrated Development Environment (IDE) to interface with the new control system. Although there are other methods for programming and interfacing such as the MIT/Google App Inventor, the Android Studio IDE provides the most flexibility through its utilization of the Java programming language. On that note it is important that the users of Android Studio have basic knowledge of the Java programming language and be familiar with some key object oriented concepts such as classes, methods, and inheritance. This document also utilizes some XML for creating a test application, however the test code given by Android Studio will work fine for our application. You should expect to spend anywhere from 30-45 minutes to properly set up Android Studio and the ZTE Speed phone.
Android Studio is a developer tool for applications that you use everyday on your android devices. The control system FTC Robotics runs on is simply an app that can be downloaded on your Android device. The FTC competition only allows the use of the following Android devices for controlling the robot:
- ZTE Speed
- Motorola Moto G (2nd Generation)
As stated in the title, this document will focus on the setup of Android Studio and ZTE Speed phone. It will not go into programming teleop or autonomous modes, or the FTC Robot Control and Driver Station Apps. Lastly it is important to note that this document is based around using a Windows Operating System.
- Android ZTE Speed Phone
- Micro USB to USB cable (should come with the phone)
- Computer with the specs shown here:
Note: Your computer is not required to have Java Development Kit (JDK) 7 previously installed as that is the first step in the setup process.
Step 1: Download and Install the Java Development Kit and Android Studio
As Android Studio is a Java based IDE we must first install the Java Development Kit (JDK). At this time Android Studio requires JDK version 7.
1. Download the JDK from the following website.
Note:When downloading the JDK, you will want to select either the Windows x86 or x64 option dependent upon whether you are using a 32-bit or 64-bit version of Windows respectively. In Windows 10 to find out which version of Windows you are running simply go to Start and search about your PC. Your operating system version is shown under System type within the about your PC menu. Also note that you only need to download the development kit (Currently Java SE Development Kit 7u79), no other files are required.
2. Follow the Steps within the Installation Wizard selecting the default recommended settings.
3. Upon completion hit the "Close" button to close the installation wizard. You do not need to click on the "Next Steps" button.
4. Download the latest version of Android Studio from the following website
5. Follow the installation wizard selecting the default values for the settings.
Note: When the installation prompts you for the install locations, make sure you note the install location of the Android SDK. You may need to know this location later to find and run tools that are available in SDK.
6. Select the "Finish" button after completing the installation to close the installation wizard and launch Android Studio.
Note: Upon completion you may be prompted to import Android Studio settings from a previous installation of the software. Select "I do not have a previous version of Android Studio or I do not want to import my settings".
Step 2: Set Up the Android SDK Manager
Android SDK Manager is an application within the Android Studio software. This application is used to install SDK components and tools that you can use later to build your app.
1. select the configure menu on the welcome screen of Android Studio.
2. In the configure menu, select the "SDK Manager" option
3. Make sure that a recent version of Android SDK Tools, Android SDK Platform-tools, and Android SDK Build-tools are installed on your machine.
4. Install the SDK Platform and Google APIs for API 21.
5. Install the Google USB Driver under the Extras package.
Note: To install items simply check the box next to whichever item you are looking to install. After selecting all of the items you wish to install click the "Install x Packages" button.
6. Accept the users license agreements and select "Install"
Step 3: Create a Test Application
Next we need to create a test app so that after we set up our ZTE Speed phone we can verify that we are able to program and install apps to the phone later.
1. Select "start a new Android Studio project" on the welcome screen of Android Studio.
2. Provide a name for your new project.
Note: As this is just a test program you may just use the default "MyApplication" for a name if you like.
3. Leave the default Company Domain name and save the project in the location of your choosing.
Note: Android Studio uses the names from an internet domain to make the Java classes you create unique. Android Studio stores your classes using this domain name.
4. Check "Phone and Tablet" and accept the default value for the Minimum SDK field.
5. Create a "Blank Activity"
6. Accept the default values when prompted for information about the blank activity and select "Finish".
Note: While building the project Windows may flash some warning messages about Java and/or Android Studio. You should "Allow access" for the Java and Android Studio applications.
7. In the project browser locate and select the activity_main.xml file
Note: If you did not select the default values in step 6 this file will be named differently however it's location should be the same. This location is in app > res > layout. Once a project item is selected the opened file will be displayed on the right hand side of the screen.
8. Select the "Text" tab towards the bottom of the screen underneath the Palette window to edit the layout of your activity with a text editor.
Note: If you know XML you may change the program however you like, otherwise just leave the default blank app reading "Hello World" on it for our test program.
Step 4: Set Up the ZTE Speed
Now that we have a test program we need to set up our Android ZTE Speed so that we can install our newly created app.
1. Remove the back cover of the phone
2. Remove the SIM card of the phone
3. Power on the phone and step through the on screen instructions
4. Select "Next" when asked if you would like to set up Talkback
Note: While stepping through the on screen instructions you may encounter an UICC Error, this is indicating that the SIM card was not detected. Simply hit OK to continue.
5. Select "Activate" when the Hands Free Activation mode has appeared, this activation should fail.
6. Select "Done" when the activation fails.
Note:You should now be on the home screen of your phone.
7. Find and open the "Settings" app within your phone.
8. Turn on Airplane mode and Wifi.
9. In the same Settings window scroll to the bottom of the screen and open the "About Phone" item.
10. Locate the "SW Version" heading and tap the icon 7 times.
Note: This is done to enable Developer Options on your device so that you can connect your Android Device to Android Studio.
11. Exit the "About Phone" item and verify that the "Developer Options" item is listed above "About phone".
Note: If the "Developer Options" is not listed, repeat steps 9-11.
12. Select the "Developer Options" item and check the checkbox under the "USB Debugging" option.
Step 5: Install the USB Driver for the ZTE Speed
The last step we need to do before our ZTE Speed can successfully connect with our computer containing Android Studio is install the proper USB Driver for the ZTE Speed.
1. Connect your ZTE Speed to the computer with a micro USB to USB connector.
2. Swipe down from the top of the touch screen and click "Touch for other USB options".
3. Select Install Driver and your computer should prompt you if you want to run the install program "AutoRun.exe".
4. Select "RunAutoRun.exe" to begin installation.
5. Follow the installation wizard to finish installation.
6. Swipe down from the top of the touch screen and click "Touch for other USB options".
7. Select "Charge only".
Note: If done correctly after selecting "Charge only" your ZTE Speed should prompt on whether or not to allow USB debugging by your PC. If you do not receive this prompt you can unplug your phone from the USB cable, wait a few seconds, and then reconnect the device.
8. Check the "Always allow from this computer" box and hit OK on the prompt.
9. Verify that the ZTE Speed is an available Android device in the Android panel of Android Studio.
Step 6: Compile and Install Our Test App
The last step is to compile and install the test app we created previously onto our Android ZTE Speed. This is essentially a check to make sure that we have set up everything within Android Studio and on our Android ZTE Speed phone correctly.
1. Unplug the ZTE Speed from the computer wait a couple of seconds and then reconnect the device.
2. Go to the "Run" tab within Android Studio at the top of the page and select "Run 'app'".
3. Select the "Gradle Console" tab in the lower right hand corner of the screen to monitor the build of your application.
4. Verify that the build was successful within the Gradle Console window.
Note: If the build was successful Android Studio should ask you to select a target device. If the build was unsuccessful go back to Step 3 "Create a Test Application" of this document and verify that everything was done correctly.
5. Select the ZTE Speed phone as the target device and select OK to install it to the phone.
Note: The target device shown in the image for this step is an LGE Nexus 5, whereas yours should be the ZTE Speed.
6. Verify that your app has ran properly on your phone.
Congratulations! You have just created your first Android application using Android Studio. Your ZTE Speed and Android Studio should now be properly set up for you to begin programming for this FTC Season!