BlueStacks - Android Virtual Devices don't get assigned IP and port - android

I just installed BlueStacks latest version using the default configuration.
Then I ran the Android SDK command:
> adb devices
and I got:
List of devices attached
emulator-5554 device
As you can see, the BlueStacks doesn't get an IP and Port.
I cannot deploy from MSVS2015 to this AVD and I think that's the reason, because I also have Genymotion AVD installed which has an IP and Port and this is visible by the MSVS2015.
List of devices attached
192.168.189.101:5555 device
How can I make the BlueStacks get an IP and Port for the AVD and then deploy to it from MSVS2015/Xamarin?

Try this: run netstat -a in your command prompt. If you see 127.0.0.1:5555 running, then everything is okay, else disable your firewall. Then run adb connect 127.0.0.1:5555. Hope it helps.

For me the following did the trick: On the Bluestacks machine (assuming it is a Windows machine) run cmd as Administrator and type in:
netsh interface portproxy add v4tov4 listenaddress={ip.of.bluestacks.windows.machine} listenport=5555 connectaddress=127.0.0.1 connectport=5555
Now you can connect from remote machine using
adb connect {ip.of.bluestacks.windows.machine}:5555

Related

How to connect from VirtualBox machine to Host windows through ADB?

I'm using Android Studio 2021.1.1 in windows10 and Santoku in VirtualBox 6.13 and i want to connect through ADB tool from Santoku to the Android Emulator that is running in windows.
I have check the ip for the android emulator from adb tool in windows and i got the ip address for the emulator which is
C:\Users\x\AppData\Local\Android\Sdk\platform-tools>adb shell
root#android:/ # ifconfig eth0
eth0: ip 10.0.2.15 mask 255.255.255.0 flags [up broadcast running
multicast]
And when i use adb connect 10.0.2.15:5554 in vm it gives me
unable to connect to device
after checked many solutions like these:
How to connect a socket to Genymotion device that is hosting a server?
Connect Genymotion from Another VirtualBox machine with adb
I have an idea about the problem that is i need to set the network adapter from NAT to bridge in Android Emulator but I don't know how to set it up in SDK .

How do you adb to bluestacks 4?

I'd like to connect to android emulator on bluestacks 4 with adb.
but I've got an error with adb.exe -s emulator-5554 shell
checking devices.
$ adb.exe devices
List of devices attached
BH901... device
CB512... unauthorized
emulator-5554 device
once I shutdown bluestacks window, the emulator-5554 will be hidden from above command's result. thus I think emulator-5554 means bluestacks.
then commnad as below to use adb.
$ adb.exe -s emulator-5554 shell
error: closed
but as you know, an error occured.
First, in Bluestacks, go to Settings -> Preferences -> Enable Android Debug Bridge (ADB). Like this:
At this point, Bluestacks enables its adb functionality and exposes itself to the localhost at port 5555 (the default port)
So, in your command line, type adb connect localhost:5555 and you should be good to go.
I did exactly as the chosen approved answer but i still could not connect my android studio to Bluestack 4. Hence i think the problem both of us are encountering could be due to bluestack device ip has changed. (Even if you had detect the device using adb devices command earlier on). Each time i open up my bluestack emulator, i notice that its ip is always different. Hence that could be one of the reason why you could not add adb to bluestack4.
The following step works for me. I am using windows 10, Android Studio 4.0.1, Bluestacks 4.200.
find your android studio sdk platform tool folder. For me its is
custom installed in my D drive. for example->
D:\AppData\Local\Android\Sdk\platform-tools
right click on adb.exe and run as administrator. (click on yes if
a pop up ask if you would like to make changes to your devices.
After that you would only see another pop up that suddenly
disappear.)
open Bluestacks. Run your selected emulator (samsung/pixel etc).
Ensure that you have enable "Enable Android Debug Bridge (ADB) in
the emulator preferences.
open platform tools folder path: Click on address bar, alternatively press Alt + D. Now when address bar is highlighted, type cmd in the bar. Press Enter key.
enter the following command->adb connect xxxxxxxxxxx
where xxxxxx is your device localhost ip. (see attach pic. My device ip is
127.0.0.1:xxxxx hence my command is ->adb connect 127.0.0.1:xxxxx
continue with the following command->adb devices
you would see your bluestack emulator device. same ip listed.
open your andriod studio. you would be able to see your bluestack
emulator
[
And I have test bluestack 4 in windows 10 and enable the adb permission in bluestacks 4 settings. It works for me.
After enabling adb in blue stack
go to platform-tools folder
e.g. "C:\Users\Your Username\AppData\Local\Android\Sdk\platform-tools"
run this in cmd "adb connect localhost:5555" or whatever port given by bluestack.
or just run directly from Win+R
"C:\Users\Your
Username\AppData\Local\Android\Sdk\platform-tools\adb connect
localhost:5555"
n.b. localhost = 127.0.0.1
On BlueStack 5 it should be in Advanced -> Android Debug Bridge

ADB on WIFI for Android 2.3.7

I have a rooted Samsung Galaxy Gio running MIUI 2.4.20. Is there any way to use ADB over the network?
If you have a terminal emulator on your device, this tutorial enables ADB over WIFI without installing additional software.
In short, execute the following on your phone's terminal emulator:
su
setprop service.adb.tcp.port 5555
stop adbd
start adbd
You can use another port, ohter than 5555, if you want.
Find out which IP your device is using on WIFI. One way is, on phone's your terminal emulator, run the command below and search for the IP in the wlan0 section.
ipaddr
On your computer (mine is a Linux machine), in your android SDK instalation, go to the platform-tools folder and run:
./adb connect <ip-address>
If you chose a different port run:
./adb connect <ip-address>:<port>
And you're set!
Link: http://forum.xda-developers.com/showthread.php?t=1685736
I have found this useful software (Easy Remote), it's working with android 2.3.7.
Easy Remote Link: http://bartwell.ru/soft/android/easyremoteadb/
Download
APK : Download (318.95 KB)
Google Play
EXE (749.06 KB)

Eclipse Android X86 Cannot connect to 127.0.0.1

Running Eclipse Build id: 20110615-0604
Android SDK & AVD Manager (setup in eclipse)
Android X86 2.3-RC1.eeepc.iso
Oracle VM VirtualBox Version 4.1.2.r73507 (installed and running android)
In the VM using Alt F1 and the command netcfg produces:
Android root#eeepc:/ # netcfg
lo UP 127.0.0.1 255.0.0.0 0x00000049
The path for Android is set in eclipse to C:\android\android-sdk
In the tools directory I use the command 'adb kill-server'
I then use 'adb connect 127.0.0.1' which produces:
unable to connect to 127.0.0.1:5555
I have a virtual device setup already in Eclipse using the AVD manager and this works perfectly - though very slowly, hence the need to use X86.
When the working emulator is running the command 'adb devices' produces:
List of devices attached
emulator-5554 (the slow emulator)
When the slow emulator is running and I then use the command 'adk kill-server' and use the command 'adb connect 127.0.0.1' it produces:
C:\Android\android-sdk\platform-tools>adb connect 127.0.0.1
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
connected to 127.0.0.1:5555
So then I go back to:
C:\Android\android-sdk\platform-tools>adb kill-server
C:\Android\android-sdk\platform-tools>adb connect 127.0.0.1
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
connected to 127.0.0.1:5555
C:\Android\android-sdk\platform-tools>adb devices
List of devices attached
emulator-5554 device
127.0.0.1:5555 device
But the new X86 device, presumably at 127.0.0.1:5555 doesn't appear in the AVD manager. Should it? I'm stumped.
I've googled everywhere so any help would be greatly appreciated. Thanks.
Hello James,
I tried a similar set up and I got the same error as you. I eventually gave up using virtualbox. After struggling for two days I switched to using vmware and I had to use a different image.
I used the following image: http://android-x86.googlecode.com/files/android-x86-2.2-r2-eeepc.iso
and for the vmware set up I followed this tutorial: http://vmetc.com/2010/12/27/install-androidx86-in-a-vmware-workstation-vm/
Do not skip over the part that says to edit the virtual machines configuration file.
I hope this helps.
You might also want to consider using the android image provided by http://www.vmlite.com/ it worked right away for me and I connected using "adb connect 127.0.0.1"
I had the same problem of "unable to connect to 127.0.0.1:5555". I then found here:
http://www.android-x86.org/documents/debug-howto
...
2.using adb with a NAT'ed VM
•The steps above work nicely if you have a VM which is set up to use Bridged or Host-Only adapters
•However, if you have a NAT'ed VM you cannot connect to the VM IP from the host
•You will need to set up port forwarding for a host port to be forwarded to the VM port 5555 (which is adb)
VBoxManage modifyvm --natpf1 adb,tcp,,,,5555
Example from one machine:
VBoxManage modifyvm froyo --natpf1 adb,tcp,,5555,,5555
•Once this is done, you should see the local port (i.e. 5555 in this case) bound on the host via netstat -a
•You can now connect to the VM by adb localhost:5555
That solved the problem for me. Good luck!

android emulation on virtual box in eclipse

I have android running on virtualbox, to use it as a second cell phone with an bluetooth usb stick, to connect it with a real device.
I have 2 Questions:
Is it possible to get access with DDMS in eclipse like the real device to the virtual box version?
How can i install in .apk package on the virtual box android?
I hope somoeone can help me.
Thanks!
Press Alt+F1, type netcfg write down the IP address and press Alt+F7.
Run adb connect <virtual_machine_ip> in terminal on your host machine.
You should then see the device in ADT and be able to run your applications on it.
Edit: This will work if you are set up to use bridged or host-only adapters: for NAT you must set up port forwarding first:
cd to your VirtualBox folder on Windows: (C:/Program Files/Oracle/VirtualBox)
set up a port forwarding rule via command line like so: VBoxManage modifyvm <name_of_your_android_vm> --natpf1 adb,tcp,*,5555,*,5555
Run your vm
Connect to your VM by typing adb connect localhost:5555
Launch your application in Eclipse and you will see localhost:5555 as an available AVD

Categories

Resources