I use the emulator AVD and i have 3 android :
First name Android : test
Second name Android : test1
Third name Android : test2
I launch the first and second android with command line :
emulator -avd test
emulator -avd test1
And after, when i use this command line :
avd devices
I have
List of devices attached
emulator-5556 device
emulator-5554 device
How i can identify my android emulator with adb (only command line)?
If it's impossible, how I can know if my device is started with "emulator" (only command line) ?
Try doing a TELNET to the AVD
emulator -avd test
emulator -avd test1
avd devices
List of devices attached
emulator-5556 device
emulator-5554 device
telnet localhost 5554
Trying 127.0.0.1...
Connected to localhost.
...
OK
avd name
test1
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 am trying to develop and application who connects to a serial port. For that, I am following this api:
https://code.google.com/archive/p/android-serialport-api/
https://github.com/cepr/android-serialport-api
When I run the application in a real device it works, but when run in the android emulator, no serial ports are shown in the setup activity.
I am doing the following steps to run the emulator:
C:\Users\myuser\AppData\Local\Android\sdk\tools\emulator.exe -avd Nexus_5_API_23 -qemu -serial COM1
C:\Users\myuser\AppData\Local\Android\sdk\platform-tools\adb.exe wait-for-device
C:\Users\myuser\AppData\Local\Android\sdk\platform-tools\adb.exe shell chmod 666 /dev/ttyS2
Similiar to this link:
https://github.com/cepr/android-serialport-api/blob/master/android-serialport-api/project/run_emulator.sh
I am using a Nexus 5 emulator, Should I choose another emulator?
What I am doing wrong? What I am missing?
I know to install apk file on emulator you type,
adb install [apk file name]
So, I followed and I have received this error,
antz#antz-90X3A:~/Android/androidmalware$ adb install 01_AngryBirdsRiov110.apk
error: device not found
- waiting for device -
when i checked android android virtual device, I have an device.
Do I have to something else to link?
Command for running emulator is:
emulator -avd <youravd.avd>
Sounds like you don't have an emulator or device connected to your computer. You can check if you have a device available by typing:
adb devices
Just because you created an AVD doesn't mean it is running. You need to start an emulator using the AVD you created.
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
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