Reputation: 145
I'm programming the flutter on android studio , but for running my app i need a virtual device to connect . Android Studio cannot find my Virtual device (Memu play) , can anyone help me about this problem.
Upvotes: 2
Views: 6246
Reputation: 51
I have the same problem plus that I`m getting below error:
adb.exe, start-server failed -- run manually if necessary
so I did below steps to resolve it:
Open Task Manager
Go to Details tab in Task Manager
Find "adb.exe" and right click on it and select End task
Open YOUR_SDK_DIRECTORY\platform-tools folder and then on address bar type "cmd" to open cmd window for this path
Type "adb start-server" to start adb server again
Start MEmu emulator in your desktop
Return back to Details tab in Task Manager and note down PID related to "MEmuHeadless.exe"
To find which port is used by MEmuHeadless.exe write below command in opened cmd window and replace the noted down PID instead of PID:
netstat -ano | findstr PID
Note: You should Find a line like "TCP 127.0.0.1:21503 127.0.0.1:18194 ESTABLISHED 20200" at the result of running command
Start Android Studio
Write below code to connect adb to MEmu emulator in opened cmd window:
adb connect localhost:21503
Note: if adb.exe is running without any problem, by default MEmu Emulator runs on 21503 port so you can simply do this
Open YOUR_SDK_DIRECTORY\platform-tools folder and then on address bar type "cmd" to open cmd window for this path then write below command:
adb connect localhost:21503
Upvotes: 0
Reputation: 51
WORKING SOLUTION 2023
I had to connect the Memu emulator with the Android studio on my virtual machine of contabo. I tried different ports to connect with but ports like 21503 didn't work for me.
Type adb devices
(get a list of emulators running with IP address and port)
Use the command adb connect IP_ADDRESS:PORT_NUMBER
(will get ip and port from above command, this will connect your adb/emulator with Android studio and you can run the app)
MEMU Emulator IP and port detection
Alternatively, you can also try different ports with this sequence.
The first gate starts at 21503
Each port after increasing the value by 10.
So for the four cases, the port values would be:
21503
21513
21523
21533
And such…
Upvotes: 2
Reputation: 51
First open android studio and memu play.
After sometime if the memu play instance is detected you can use it, otherwise go to memu play shortcut file location and open command prompt by typing cmd in the bar where the path is present.
After opening, type the below command : adb connect localhost:21503
After typing the command wait for 5 seconds and the instance will be detected by Android Studio.
Note: Don't close the cmd window and memu instance until your work is finished.
If you're using BlueStacks then go to BlueStacks instance settings and then preferences and then tick the option "enable android debug bridge" and restart android studio after enabling adb.
Upvotes: 5