Using Bluestacks for Fast Android Emulation

Android DevelopmentTesting Android applications on PC or Mac without a physical device can be quite a burden. The configurable Android virtual machines in Eclipse/Android Studio are notably sluggish and don't work well with many third party frameworks, especially those powered by C++. If your development machine has Intel-based hardware you can accelerate the emulation process by using Intel® HAXM technology, but AMD users are not yet so lucky.

The fastest and easiest way I've found to test Android applications is via the BlueStacks app player. BlueStacks is a free, ad-supported product for PC and Mac that enables you to download and run Android applications from your PC, as if using an Android device itself. BlueStacks isn't the only product on the market of its kind, but it does boast higher compatibility and a greater feature set than the competitors. According to BlueStack's feature chart, it supports up to 96% of all apps and 86% of all games on the Android market. Furthermore, BlueStacks offers streamlined emulation of the Android device's camera, microphone, multitouch and more which makes it ideal for testing in-development apps.

Installing Android Debug Bridge (ADB)

To use BlueStacks for debugging Android apps, you'll want to make sure you have the Android Debug Bridge (ADB) installed and operational. Some unofficial packages exist to get ADB in a hurry, but I have not tested said packages personally and it is easy enough to get it up and running through official means.

  1. If you haven't already done so, download and install the Android SDK Tools package from Google. ZIP files are offered for Windows, Mac and Linux; extract the contents to a dedicated directory.
  2. From the extracted file location, launch SDK Manager.exe. Under Tools, check the box to install "Android SDK Platform-tools" and press the Install button. You will then have to click "Accept License" and then "Install" to download and install these components.
Android Debug Bridge (ADB)

Android Debug Bridge (ADB) is part of Android's SDK Platform-Tools component.

  1. Once installed, you will find ADB.exe within the "platform-tools" subfolder of the location you extracted the original files to. You can run this file from the command prompt without any parameters, or visit its official page on Google, to review the multitude of available settings. I recommend that you also append the ADB location to the PATH environmental variable [assuming it is a Windows install] so that it can be ran from any command line prompt without having to navigate into the folder directly.
    1. Press Windows Key + Pause/Break on your keyboard to get to the System Information screen.
    2. Click on Advanced System Settings in the left menu.
    3. Click the Environment Variables button.
    4. Double click the Path entry under System Variables.
    5. Go to the end of the field and make sure there is a semicolon (;), then insert the full platform-tools path (i.e., C:\android-sdk\platform-tools\)
    6. Click OK three times to close out of the dialog windows.
  2. Now if you have a physical Android device attached to your computer (with USB Debugging enabled), you should be able to type ADB devices from the command prompt to see a list of available devices for testing [the ADB daemon will start automatically with this command if it is not already started].
Android Debug Bridge (ADB)

A list of connected Android devices accessible via ADB.

Installing BlueStacks App Player

Installing and configuring BlueStacks is as easy as installing any computer application.

  1. Head on over to http://www.bluestacks.com/ and click the Download button, which will match your target platform (Mac or Windows).
  2. Once downloaded, launch the EXE and follow standard install procedure on Windows, or double-click/drag the app file to your Applications folder on Mac.
  3. When you first launch BlueStacks, you will be taken through an initial configuration screen much like when booting a new Android tablet.
  4. You will want to sign-in using a Google account in order to access the Google Play store and synchronize app data and settings.
  5. When all is said and done, you'll be at a landing page with easy access to your Android applications.
BlueStacks App Player

BlueStacks App Player

Running Development Apps Through BlueStacks

With ADB and BlueStacks installed, all that remains is to connect ADB to the BlueStacks player and send your Android app to it. Note that the free version of BlueStacks is ad/app supported so you may occasionally be prompted to install promoted apps before continuing. Alternatively, you can buy a year-long license for $24, the full version can also enhance performance.

  1. Launch BlueStacks so that the main dashboard screen is visible.
  2. Open a command prompt (or terminal on Mac) and enter: adb connect 127.0.0.1 then press Enter. This will connect the BlueStacks player as a device on port 5555 by default.  If the ADB command does not work, chances are you didn't set your path variable correctly; you can navigate to the platform-tools folder and run the adb command from there instead.
  3. From within Eclipse or Android Studio, click the Run or Debug button. This should open up the Android Device Chooser window where you will see the BlueStacks player and any other physical devices connected to the computer. Select the correct option and hit OK. The app should transfer to BlueStacks very quickly and will run much more fluidly than the default virtual machines!
Android Device Chooser

Note that the BlueStacks player has been identified as a Samsung SM-G900F.

Happy coding!

8 thoughts on “Using Bluestacks for Fast Android Emulation

  1. Oh!...
    It used port 10001 instead of port 5555...
    That's strange...
    Thanks though ><...

    Now I have a question of: Why it uses port 10001 instead of default port 5555?

  2. I install a copy on my Window 10 yesterday and only see that it wait for the debugger to attach. It no longer works. Any replacement for that? Thanks

Leave a Reply