3.1. How to Load and Debug APKs using Android StudioΒΆ


Using Android Studio on a TI development board running Android is very similar to using Android Studio on any other Android based phone or tablet. This guide will walk through the steps necessary to use Android Studio to load a provided example onto your TI development board (either an AM572x GP EVM or an AM57xx IDK + LCD) and run it.

This guide is not meant to replicate Google’s documentation for Android Studio or Android hardware debugging.

What you will need

At a high level, you will need the following hardware and software:

  • Android Studio
  • A TI EVM (AM572x GP EVM or AM57xx IDK + LCD) booted to the Android Home Screen with a micro USB cable connected
    • There is only one micro USB cable on the AM572x GP EVM
    • You should connect to the micro USB cable on the opposite side of the four RJ-45 jacks on the AM57xx IDK boards (the other micro USB is for UART/serial and JTAG)
    • If you are having trouble getting your board booted see the Processor SDK Android Getting Started Guide

Put Your Board into Development Mode

Go to Apps -> Settings -> About Tablet -> then tap ‘Build number’ 7 times to put the EVM into Developer Mode. The following screenshots illustrate the process.

  1. Tap the button highlighted below to access the list of installed applications
  1. Tap the settings icon
  1. Tap ‘About tablet’
  1. Tap ‘Build number’ 7 times in a row
  1. After tapping 3 times there will be a pop up on the screen counting down the number of taps left to become a developer. On the 7th tap you should see the pop up shown below indicating that your board is now in development mode.

Verify that ADB Sees Your Board

This step makes sure that your board is being recognized by the ADB server running on your Linux host machine.
Navigate to the install directory of the Android Processor SDK on your Linux host
cd ~/ti-processor-sdk-android-am57xx-evm-04.00.00.xx/
Use the adb utility in the bin directory to check if your Android board is being recognized (remember your board should be booted and connected to your Linux host machine using a micro USB cable)
./bin/adb devices
You should see output similar to this:
List of devices attached
02006013660e0121        device

If you do not see a device listed, you can try the following things to get your device to show up:

  • Restart the ADB server on your Linux Host Machine sudo ./bin/adb kill-server sudo ./bin/adb start-server
  • Unplug and the replug the micro USB cable between the board and your Linux host
  • Reboot your Android board
  • Reflash your Android board

Import an Example in Android Studio

  1. Open Android Studio
  2. Click File->New->Import Sample...
  1. Scroll down and select the Basic Gesture Detect and follow the prompts to import the sample
  1. Once you’ve imported the sample project it should show up in your Project explorer tab and you can browse the source files like this:

Build and Run the Example on your Board

  1. Click Run->Run ‘Application’ or Run->Debug ‘Application’ to build and run/debug your program
  1. Select your device from the Select Deployment Target pop up and click OK

At this point Android Studio will build your project, load it onto your board, and then start the application

This is a screenshot of the application running on the board before tapping the screen:


This screenshot show that after tapping the screen in the specified box, the application records the touches:


More Information

You’ve now built, loaded, and run your first APK on your TI EVM running the Android Processor SDK! As you’ve seen, this process works just like on any other Android enabled device (phone, tablet, etc.). If you would like more information about Android Studio, or developing Android applications, please visit Google’s Android Developer documentation.