ADB more than one device/emulator but there isn't - android

(master) $ adb -s emulator-5554 reverse tcp:8081 tcp:8081
error: more than one device/emulator
(master) $ adb devices -l
List of devices attached
emulator-5554 device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:2
Trying to deploy a react-native app to an emulated device. The build, gradle etc runs fine but when trying to connect to the emulator it shows an error more than one device/emulator despite there only being one device when running adb devices
Literally no idea how to solve this, Android Studio 3.1, emulated device is a Nexus 5x running Android 8. Have restarted, upgraded etc but still get this message.

Related

How do I adb disconnect an emulator and keep it disconnected?

I have somehow gotten a couple of Android emulators connected via ADB and I can't get rid of them.
> adb devices -l
List of devices attached
emulator-5554 device product:sdk_gphone_x86 model:sdk_gphone_x86 device:generic_x86_arm transport_id:1
emulator-5556 device product:sdk_gphone_x86 model:sdk_gphone_x86 device:generic_x86_arm transport_id:2
When I adb disconnect it disconnects everything, but they come back almost instantly (with an incremented transport_id)
When I adb kill-server and then adb devices -l it restarts the adb server (as expected) and reconnects the emulators. I understand that it scans the even ports from 5554 : https://developer.android.com/studio/command-line/adb#howadbworks
When I run the emulator list devices they don't appear:
> .\emulator.exe -list-avds
Nexus_5_API_30
Pixel_2_API_29_x86_64
Pixel_4a_API_30
Tablet_API_30
I don't think I've got another Android SDK Emulator suite installed locally.
The correct way of killing an emulator would be:
adb -s emulator-5554 emu kill
I managed to find the process that was running the emulators:
On windows, using Powershell:
> Get-Process -Id (Get-NetTCPConnection -LocalPort 5554).OwningProcess
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
134 4,074.23 1,998.07 2,544.47 12528 1 qemu-system-x86_64-headless
And killing that using the process manager did the trick.

APK is not installing in docker emulator

I am trying to install an apk file on my virtual adb resides in a docker container. Whenever I try to install the apk getting the response
Aborted
The devices listed for the adb device command are
List of devices attached
emulator-5554 device
I endup getting same error for the command adb -s emulator-5554 install apk_path. The same is working for some other container and don't have the faintest idea why it is happening so.

Android application execution

I am executing an Android chat application on my Windows 7 PC (not using Eclipse). I created one emulator in AVD manager and installed that application using ADB.
I want to know how to run that application in two Android virtual devices simultaneously. Can anybody help?
type:
adb devices
you'll see for ex:
emulator-5555
emulator-5554
To install your app on each one:
adb -s emulator-5555 install yourapp.apk
adb -s emulator-5554 install yourapp.apk

emulator in commandline do not have always the property "dev.bootcomplete"

I'm using the emulator by command-line for our continuous integration server for our android application. With that approach we can test all Android Versions automatically. For the automatic installation and testing we are using the property "dev.bootcomplete", which is provided by the android emulator. Unfortunately we don't get it always. After a newly created emulator we are retrieving it, but when the emulator is several times used it do'nt throw it again...
Has Anybody an idea?
Commands/ results:
[user#mob_ci ~]$ adb shell getprop dev.bootcomplete
error: device offline
[user#mob_ci ~]$ adb shell getprop dev.bootcomplete
1
I use hudson as a ci server, for hudson there is a android plugin which manages the emulator, it even creates the emulator for you if you want.
I would either check if "error: device offline" happens and then run
adb kill-server
adb start-server
or
shutdown the emulator after each build, as it's not necessary that the emulator runs all the time or do the tests run all the time ?
hope this helps :)

Problem when run adb command / Problem of developing with tablet device

I followed the tutorial to set up ZTE tablet device for development. I am developing under Ubuntu 10.04.
After create the rules file: /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"
After I plug in the ZTE tablet device with debugging enabled. I run command:
adb kill-server
adb start-server
adb devices
I got :
List of devices attached
???????????? no permissions
I thought may be it is because I did not restart adb as root. SO, I tried to restart adb as root, and I entered the command in my terminal:
sudo adb kill-server , but I got the message in terminal that "sudo: adb: command not found"
But if I enter command without "sudo", that's "adb kill-server" it works.
Is it because my path setting is wrong?????
I set the path under HOME/.bashrc, with :
export PATH=$PATH{}:/home/user/android-sdk-linux_x86/platform-tools:/home/user/android-sdk-linux_x86/platform-tools
Conclude all above, I got two problems:
the adb listed device has no permissions
I can not run adb as root
My questions:
Are the problems all because of my path setting is wrong?
Is it because ZTE tablet device is different from mobile device? Some tricks need to be done for tablet??
something else?
Where am I wrong?
P.S. Since I lost the USB cable shipped with the ZTE tablet, I use a NOKIA USB cable to connect the ZTE tablet with my development Ubuntu machine, could this also cause the above problems???? (With Nokia USB cable, I can still access the ZTE tablet file system anyhow)
Every thing goes fine after I run the command:
sudo -s
adb kill-server
adb start-server
adb devices
Then my ZTE tablet is shown.

Categories

Resources