Use mobile as an emulator for android studio

Share this

In this post we will see how to use Android mobile as an emulator for android studio.

android studio built in emulator is bit heavy and if your PC configuration is low then you have noticed that launching emulator is time consuming task. it may take more that 5 minutes to start completely. Emulator consumes lots of memory and this makes whole system slow.

so lets get started.

We can connect mobile phone to PC via USB cable or Wifi.

Before this we have to enable usb debugging in mobile.

follow these steps to enable developer option if you have not enabled it.
1. goto your phone setting then about phone

developer options enable usb debugging

2.look for option build number/version

developer options enable usb debugging

3.tap on this for 7  times

developer options enable usb debugging

then it will be enabled

4.go back to setting you will see new Menu option developer option.

developer options enable usb debugging

5.click on this enable it now

developer options enable usb debugging

6.scroll down you will see usb debugging.
enable this

developer options enable usb debugging

7.some device may block you to install app via usb.
so there is one more option.
allow install via usb
enable this too

8.connect your mobile to pc using USB cable.

developer options enable usb debugging

9.open android studio
open project you are working on
click run
here your mobile phone is shown connected via usb.

Use mobile as Emulator in Android studio

10.if still its not showing then you need to install/update adb driver on your pc.
search on google ‘adb universal drivers’
download it install it
now your phone should get connected

Use mobile as Emulator in Android studio

11.you may get permission prompt to accept debugging from your pc/laptop.
just accept it.

Use mobile as Emulator in Android studio

12.your phone is now visible under adb connected devices and ready to use as emulator.

Use mobile as Emulator in Android studio

On some mobile phone sometimes you may get problem app crash like on miui devices redmi note 3.
for this disable instant run feature of android studio.

1.Android Studio
click file menu then goto setting

disable instant run android studio

2.on left select Build,  Execution, Deployment
exapand it.

disable instant run android studio

3.select instant run. on right uncheck Enable Instant run to disable it.

4.you can see your connected devices log in Android Monitor.

Use mobile as Emulator in Android studio

Second way to connect mobile phone is over wifi

A. For un Rooted mobiles
1.your mobile phone and laptop/PC must be connected to same network.

2.First  connect your mobile to PC via USB as above.

3.goto terminal window of android studio
type commands as follow.

adb tcpip 5555
press enter

Use mobile as Emulator in Android studio

4.following msg should displayed
restarting in TCP mode port: 5555

5.if you get msg like adb not found
then you need to add adb path to system variable.

6.adb path is
C:UsersUserAppDataLocalAndroidsdkplatform-tools
copy your path

7.Right click on computer icon on your desktop goto properties.

adb not found solution

8.on left click Advanced system settings

adb not found solution

9.System properties window will open
goto Advanced Tab
click Environment Variables

adb not found solution

10.Under System variables.
look for path select then click edit

adb not found solution

11.Edit system Variable
in variable value to goto end of line
appeend semocolon ‘ ; ‘
then paste path we copied .

adb not found solution

12.click ok save all settting.

restart Android Studio.
now try again
your commands should work now

13.now look for ip of your mobile
goto setting about status
you will see your mobile ip address here.
my is 192.168.0.105

connect mobile to android studio via wifi

14.go back to terminal window
type following command
adb connect 192.168.0.105
press enter
connected to 192.168.0.105:5555

connect mobile to android studio via wifi

15.you will see your mobile is now connected and ready to use.
you can remove USB connected.

for this method you need to connect using usb for first time.

if you dont like this try second method but for this your mobile must be rooted

B. for rooted mobile


1.Download terminal emulator app from play store.

2.open and type or paste following commands one by one.

3.command
su
press enter you will need to accept super user permission

connect mobile to android studio via wifi

4.command
setprop service.adb.tcp.port 5555
enter

restart adbd by following command

5.command
stop adbd
press enter

6.command
start adbd
press enter

connect mobile to android studio via wifi

 

7.now in terminal window of android studio
type last command
adb connect 192.168.0.105

yes your mobile is now connected over WiFi without using USB cable.

(Tip: reserve your mobile IP address in WiFi router so it will never change and you don’t need to check every time you connect mob to PC.)

Happy coding.

If you like post don’t forget to subscribe us.
share with your friends.
and do follow us on Facebook, Twitter and Google plus.


Share this

Leave a Reply

Your email address will not be published. Required fields are marked *