Product Documentation

FairCom Edge Android IoT

Previous Topic

Next Topic

Explore Your Device with the Android Debug Bridge - adb

It’s time to drop to a command line (shell) and poke around a bit with the Android Debug Bridge (adb) command.

Open up a SHELL (CMD on Windows) to execute the adb utility. You will need to change directory (‘cd’) into your Android/sdk/platform-tools folder or ensure your PATH is set. On the Mac, tools are found here:


From your command line, execute the following:

./adb devices

Note: if you have an external device running Android, you may connect adb to it using the IP address shown on this device, issue the following command:

./adb connect <your device IP>:<port>

Once connected to the external device, most of the commands below, like "adb shell" should work properly.

Next, we will connect to our device’s ‘shell’.  

./adb shell

If for any reason you have more than one device attached (a physical device and an emulator, or even two emulators), you may get an error when trying to open the shell:

Shut down your Emulator (or ‘adb disconnect’ your Raspberry) so we have only one device attached. The simplest way to disconnect an emulator is closing it directly. Even though it is possible to shut it down from the command line, the process may be a little bit more complex. Once you quit one of your emulators, you can execute the ‘adb shell’ command again:

There are a number of other adb commands, including options to install Android packages. Here are a few handy links with more information about adb:

Now that we are confident our devices are accessible, let’s go back into Android Studio. From the initial (MyApplication) project, run the application on the Phone emulator to check that our Android Studio debugger works properly.

From the RUN menu, select Debug ‘app’:

You should see your "Hello World!" on your phone Emulator.

Android Studio is very good at detecting missing SDK needs and downloading them for you. If prompted for a specific SDK, click Yes to proceed and download any recommended packages.

Note: If you do not see "Hello World!", but just a blank white screen, stop and restart the app, or your phone emulator. Sometimes Android Studio is a bit inconsistent.

The navigation in the emulator is quite similar to the real device.

Here is a link if you want to learn more about command-line launching of your emulator: