How to use adb with emulator like Memu / Bluestacks / Nox App Player

90,440

Solution 1

I'm using Memu version 2.3 and the port used to connect it to Android studio is 21503. Navigate to your sdk's platformtools directory and execute the following in cmd.If it fails try to execute it again. You can also install samsung USB driver and try again.

adb connect localhost:21503

Solution 2

I have solved by Following steps:

Go to Memu Installation Directory: (In My Case D:\Program Files\Microvirt\MEmu)

And then Delete the adb.exe file. It should work fine for you.

Solution 3

For MEmu, Droid4X and other VirtualBox-based emulators exists very simple way:

You need forward 5555 port to you host.

For example in Droid4X you open \vms\droid4x\droid4x.vbox in text editor. It is just simple xml file.

In section <NAT> you add line:

<Forwarding name="MY_PORT" proto="1" hostip="127.0.0.1" hostport="5565" guestip="10.0.2.15" guestport="5555"/>

You can use not only 5565 port. It must be uneven and from range 5555-5585 or adb do not auto find your emulator.

Save file and start emulator. Now run adb devices and you see emulator-5564 in list.

You must edit file only on fully stopped emulator or you changes will be overwritten. It is mean stop not only virtual machine. You must stop service process too. Usually it called as VBoxSVC.exe or MemuSVC.exe or another *SVC.exe from folder of your emulator.

For Memu you need edit \MEmu\MemuHyperv VMs\MEmu\MEmu.memu. All others stay same.

Solution 4

In my case this command line didn't work for me

adb connect localhost:21503

Changing localhost to 127.0.0.1 solved it

adb connect 127.0.0.1:21503

Solution 5

I am using a memu with Android 7 and after a lot of effort I realized that on this version of Android you have to change the port to 21513 ( memu version 7.2.7 / Android 7.1 )

adb connect 127.0.0.1:21513

I hope you find it useful

Share:
90,440
ThorstenM
Author by

ThorstenM

Updated on July 09, 2022

Comments

  • ThorstenM
    ThorstenM almost 2 years

    I want to use adb with an android emulator. Can I fake a USB connection or how is this possible ?

    Emulator is rooted, USB-Debugging Option is On

    I also tried via apps like adbWireless but I get host has failed to respond (10060) error.

    Do I always need a USB-connection for initializing? How is it possible to connect adb with an emulator?

    • CoolMind
      CoolMind about 4 years
      Memu 7.1.3 (Android 5.1.1) is visible in Android Studio as "google G011A", you can install an application directly. After executing adb devices this emulator is killed (in list of devices), and Android Studio doesn't detect it until you restart the emulator.
  • taranjeetsapra
    taranjeetsapra about 7 years
    Run at cmd MEmu.exe connect 192.168.0.101:5555. Your cmd prompt should be pointing at D:\Program Files\Microvirt\MEmuHyperv
  • David Rotert
    David Rotert over 6 years
    This way seems to be right, but it does not work on Xamarin and Visual Studio 2015, so I need an other way.
  • dafie
    dafie over 5 years
    Unfortunelly changing hostport does not work. After launching emulator hostport back to previous value. That happen even if I change it right after rebooting my pc.
  • Enyby
    Enyby over 5 years
    @dafie Because you must add new line, not edit exists.
  • dafie
    dafie over 5 years
    @Enyby after adding new forwarding name with hostport=21553 when I print adb devices I can only see 127.0.0.1:21503 there. I can use adb connect 127.0.0.1:21553, but anyway 21553 is set to offline.
  • Enyby
    Enyby over 5 years
    @dafieYou need learn read: "You can use not only 5565 port. It must be uneven and from range 5555-5585 or adb do not auto find your emulator"
  • Mahdi Javaheri
    Mahdi Javaheri over 4 years
    This worked for me on Memu version 6.3.2, don't forget to enable USB debugging on emulator developer options
  • Ayoub Laazazi
    Ayoub Laazazi over 4 years
    Thanks! in my case (Memu) I found the file here: C:\Program Files\Microvirt\MEmu\MemuHyperv VMs\MEmu\MEmu.memu
  • Eyad Mohammed Osama
    Eyad Mohammed Osama about 4 years
    I'm on 7.1.6.0 and this still works for me. How did you knew the port number ?
  • MbaiMburu
    MbaiMburu about 4 years
    I checked for open ports on my machine, tried that one and it worked.
  • Evren Ozturk
    Evren Ozturk about 4 years
    That my friend. So clean solution.
  • android developer
    android developer almost 4 years
    Even though it said it got connected, I keep getting Installation did not succeed. The application could not be installed: INSTALL_PARSE_FAILED_NO_CERTIFICATES . How come?
  • Darwin
    Darwin over 3 years
    Thanks. I restarted Memu and android studio after did it.
  • Doger
    Doger over 2 years
    @androiddeveloper Enable USB debugging from Settings and it will work!
  • Esmaeil Ahmadipour
    Esmaeil Ahmadipour about 2 years
    I using MEmu ... For me the solution was your reverse ... adb connect 127.0.0.1:21503 not worked ... but adb connect localhost:21503 is working .