Using the Android SDK from the command line, I can get a list of the running devices available using:
./adb device
This gives me the serial number of available devices. How can I get the AVD name of the emulator device from that serial number (like the Eclipse ADT plugin does)?
Here it is:
> adb -s emulator-5554 emu avd name
MyDevice
OK
The Eclipse plugin does it by connecting to the emulator via tcp/ip. To connect, (for linux), type
~/code$ telnet localhost 5554
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
Replace "5554" with whatever number comes after the hyphen when you type "adb devices" - "emulator-5554", for instance, would have telnet port 5554 open.
Then, type "avd name", hit enter, and you should see something similar to the following:
avd name
GB10
OK
In this example the emulator's name was "GB10".
Using adb devices you can see the List of devices attached.
In my case the result is:
List of devices attached
emulator-5554 device
Related
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
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
I am developing an android IPTV application running on Android 4.4. Does anyone know how to connect set-top box for installing application for testing. The set-top box have a USB port to connect USB pen-drive.
Can we use that USB port for installing applications directly in STB. If yes then How ?
Please help me out with this if anyone worked on android set top box programming.
Open command line;
adb connect [Your device's IP address]
Once you connect your device via adb tool, just run your code from Android Studio. Your target device should be listed under Connected Devices.
Make sure
to add ADB to the PATH to be able to run adb.exe on cmd from any directory
the system and target device are in the same network
Turn on ADB Debugging
You must enable ADB on the Fire TV device before you can connect to the device.
From the main (Launcher) screen, select Settings.
Select System > Developer Options.
Select ADB Debugging.
Get the IP Address
You need the IP address of your Fire TV device on your network to connect ADB to it.
From the main (Launcher) screen, select Settings.
Select System > About > Network. Make note of the IP address listed on this screen.
Connect ADB
To connect your development computer to a Fire TV device, use the following steps:
Open a command prompt or terminal window.
Change directory to your Android SDK platform-tools directory.
Run the following commands, where <ipaddress> is the IP address of the Fire TV device noted in the previous section.
adb kill-server
adb start-server
adb connect <ipaddress>
Note: On Mac OS X and Linux you may need to prepend ./ to these commands, like this:
./adb kill-server
./adb start-server
./adb connect <ipaddress>
If the connection was sucessful, ADB responds with the message:
connected to <ipaddress>:5555
Verify that the Fire TV device appears in the list of devices:
adb devices
ADB reponds responds with the message:
List of devices attached
<ipaddress>:5555 device
ex : adb connect 192.168.1.1:5555
I am running Genymotion 2.3.1 on Mac OS X Yosemite. When I was running Genymotion on Win 7, I could telnet to the emulator and run commands like "geo fix" to set a location. However, on Yosemite, when I telnet to the emulator and run a command, I do not get an OK response, and nothing happens. This is an example:
$ adb devices
List of devices attached
192.168.56.101:5555 device
$ telnet 192.168.56.101 5555
Trying 192.168.56.101...
Connected to 192.168.56.101.
Escape character is '^]'.
geo fix 34 -118
sms send 1234 test
Connection closed by foreign host.
$
After running the geo fix command, I checked on the emulator, and the GPS location was not changed. The sms send command caused the telnet session to close. Any ideas?
Telnet is not supported on Genymotion.
To access the Genymotion Shell you need to open the Genyshell app or run it in command line. It will open a terminal where you will be able to do all the commands you used to do.
The commands are different than telnet, so type help to discover all the features you can access after opening this shell.
Using the Android SDK from the command line, I can get a list of the running devices available using:
./adb device
This gives me the serial number of available devices. How can I get the AVD name of the emulator device from that serial number (like the Eclipse ADT plugin does)?
Here it is:
> adb -s emulator-5554 emu avd name
MyDevice
OK
The Eclipse plugin does it by connecting to the emulator via tcp/ip. To connect, (for linux), type
~/code$ telnet localhost 5554
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
Replace "5554" with whatever number comes after the hyphen when you type "adb devices" - "emulator-5554", for instance, would have telnet port 5554 open.
Then, type "avd name", hit enter, and you should see something similar to the following:
avd name
GB10
OK
In this example the emulator's name was "GB10".
Using adb devices you can see the List of devices attached.
In my case the result is:
List of devices attached
emulator-5554 device