Android SDK and Local Testing

It’s been awhile since I installed the Android SDK, today I’m starting a new android app so I updated to the latest version. To my surprise the tools have moved to different folders so just as I was ready to start testing locally I couldn’t find adb (adroid debugger bridge) in the tools folder, turns out it’s now located in the plataform-tools folder.

Here are the steps I’m using:

First you have to create an Android Virtual Device. Star the Android SDK Manager

android:~$ cd tools
tools:~$ ./android

Download the Android API you need or download them all
download android api

Create your Android Virtual Device
create android virtual device

Now you could start you virtual device from the SDK Manager but I prefer to do it from the shell since I’m able to add command options like

  • -wipe-data (To erase data stored from previous sessions)
  • -shell (So I can edit the /etc/hosts file later)
  • -no-boot-anim (It helps the emulator to boot up faster)
  • -noskin (It minimizes memory consumption)
  tools:~$ ./emulator -avd test -wipe-data -shell -no-boot-anim -noskin

Open a new shell tab and go to the platform-tools folder and remount the image with the Android Debugger Bridge. This is to get rid of the file write permissions issue.

$ cd platform-tools
platform-tools:~$./adb remount

Now go back to the tab where we started out emulator and edit the hosts file to point to a local domain. It’s important to mention that the /etc/hosts file in the emulator is different from then system /etc/hosts. Replace to your desired local domain

tools:~$ echo '' >> /etc/hosts

And that’s it. Now you can browse locally. Hope it helps someone.