Use Android Device as Emulator

Home / Android / Use Android Device as Emulator

Emulator is provided to test the android application before running it on actual android device. But, reasons for using an android device for testing in lieu of emulator:

  • No body is going to run your application on emulator,
  • To see what your application is going to look on real device,
  • For debugging in real environment,
  • To check how your application is going to take care of itself in different devices with distinct hardwares,
  • How different screens are going to reach to the layout(s) of your application

Whatever be the reason for you to choose your physical android device to use as emulator, the steps to achieve it are as :

Enable debugging in you Android device

Android is continuously upgrading. And, because of this there are three ways to enable debug mode in Android devices. It depends on the version of Android you have.

  • For Android 4.0 and higher:
    Settings > Developer Options > Enable USB debugging
  • For Android 4.2 and higher: By default “Developer Options” is hidden
    Settings > About Phone > Tap Build Number 7 times > Back to previous screen > Developer Options > Enable USB debugging
  • For other Android versions:
    Settings > Applications > Development > Enable USB debugging

Enable system to detect connected Android device for debugging

  • For Mac, no modification is required.
  • For Windows, install USB driver for adb. Here is the list of OEM Driver Documentation.
  • For Linux, create a file /etc/udev/rules.d/51-android.rules to contains a list of permitted devices for debugging.
    $ sudo vim /etc/udev/rules.d/51-android.rules
    [sudo] password for  :

    This will open vim. Now, provide permission to access the device in following format.

    SUBSYSTEM=="usb", ATTR{idVendor}=="", MODE="0666", GROUP="plugdev"

Get vendor id

In order to enable your Android device to be debugged in Linus, you have to provide vendor-id in 51-android.rules file. To get that, connect your Android device with system. After it is connected, execute following command on Terminal.

$ lsusb
Bus 001 Device 004: ID 04e8:6864 Samsung Electronics Co., Ltd

Output of lsusb contains 04e8:6864. In it first four characters (04e8) is vendor id. Use this in 51-android.rules to enable your Android device to be debugged.

Vendor id list

You can also copy the content and paste it into /etc/uded/rules.d/51-android.rules

SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666"