What does the adb command do WITHIN an Android device's shell? - android

I was connected to my Android device's shell (by doing adb shell in my computer's shell) and without realizing, I typed adb devices. Instead of giving me a command not found error or something, it actually listed one device! The output:
$ adb devices
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
List of devices attached
emulator-5554 offline
Why does my phone have an adb command, and what is the emulator device?
EDIT: I tried it again and it still works, though now the list of devices it gives is empty. The only difference between when I did it just now and when I did it before is that before, I was doing the bridge wirelessly and now I'm doing it through a wired connection. I know that it's not running the adb command on my computer, because in both cases when I run it on my computer I get a different output.

Some phones do include the adb binary. Some for a specific purpose, others just because the manufacturer was too lazy to edit the default makefile.
Also adb devices listing an offline instance of an "emulator" does not mean that there's an emulator running on the device, just that there is an open tcp port in the range that adb scans when looking for emulator instances. Just ignore it.

Don't worry about emulator.Emulator creates a virtual android device. By using this facility a programmer can test his code on computer without connecting any device.
You can read about emulator from https://developer.android.com/training/basics/firstapp/running-app.html#Emulator.

Related

how many android devices could be plugged into ubuntu server?

I plugged 7 android devices to my ubuntu server with usb cables, but adb devices command only shows six devices. Is there any limitation of the account of android devices? Thanks.
As stated in documentation:
The adb devices command has a corner-case command sequence that causes running emulator(s) to not show up in the adb devices output even though the emulator(s) are visible on your desktop. This happens when all of the following conditions are true:
The adb server is not running, and
You use the emulator command with the -port or -ports option with an odd-numbered port value between 5554 and 5584, and
The odd-numbered port you chose is not busy so the port connection can be made at the specified port number, or if it is busy, the emulator switches to another port that meets the requirements in 2, and
You start the adb server after you start the emulator.
One way to avoid this situation is let the emulator choose its own ports, and don't run more than 16 emulators at once. Another way is to always start the adb server before you use the emulator command, as explained in the following examples.
I guess it should be pretty much the same concerning real devices too.

ADB over TCP - Devices are connected and online but installing shows Error: Device not found

Good day,
I've been using a VMWare android machine and installing .apks on it but after my computer was unexpectedly shut down and tried to re-install a package I've been having the following problem:
$ adb -s 192.168.1.2 install 'myapp.apk'
error: device not found
- waiting for device -
However I was able to connect the VM using adb connect 192.168.1.2 which is the ip currently assigned on the android, (seen it on ctrl+f1 netcfg) and then shows:
connected to 192.168.1.2:5555
$ adb devices
List of devices attached
emulator-5554 offline
192.168.1.2:5555 device
so it appears to be online.
Troubleshooting steps taken before posting:
$adb kill/start-server
Reconfigured the VM Network (I have it bridged and Internet connection works fine).
-Suspending/Shutting down and Restarting VM.
-Restarting Internet connection (Router/PC connections)
Kindly assist with situation or post links of another issue related to mine that I probably did not find (sorry for that..)
Thanks!
Edit: I'm using Fedora as OS, Eclipse for developing
When using an ADB tcp target, the device name specified in the -s parameter must include not only the IP address but the port as well, for example:
adb -s 192.168.1.2:5555 install 'myapp.apk'
(As the android emulator actually talks over TCP behind it's "emulator-####" name, one can test this by connecting to an emulator at the loopback address using the control port plus one, ie, "emulator-5554" can also be reached as a vanilla tcp target via adb connect 127.0.0.1:5555 and then you can install on it with adb -s 127:0.0.1:5555 install whatever)

adb : Cannot send commands to my device from the command line

I'm trying to enable CheckJNI in order to debug my native code (see http://android-developers.blogspot.ch/2011/07/debugging-android-jni-with-checkjni.html).
I have a Galaxy S3 with the google USB drivers installed. I can install app and see my device when I use eclipse.
My problem is that I can't send any commands from cmd.exe to my device (it says "error : device not found"). I tried to send adb shell setprop debug.checkjni 1 but I always got the same error.
I tried a different USB port, a different USB cable and I tried to start cmd.exe as an Administrator but I always got the same result. Anyone has had the same problem ? Any idea what I can do ?
Thanks
try restarting ur device and computer also
then execute following commands:
adb kill-server
adb start-server
and then see if it show device using
adb devices
for available device
then you can run commands in ur device using
adb shell ......
After trying to send commands to 2 differents devices on 2 different computers with Windows 7, I finally installed a virtual machine with Ubuntu and there I could access my devices with command lines.

Android - adb tools not finding device

I just did a factory data restore so that I could use my phone for testing.
But now I am trying to use the adb tool to put a new .apk on the device using my usb, and it says device not connected.
The phone is displaying this message: MTP: server status: connecting to computer...
But it is never able to fully connect.
I tried to go to Wireless & Networks, and enable Internet pass-through, but that option is also "Turning on..." for the last 5 minutes.
Any idea why I am not able to connect?
What kind of device is it? Make sure you have the development USB settings set under Settings, Development. Also ensure it's not a USB Drive but in USB Debugging mode.
Furthermore, if it's a device driver issue, here is an article for the HTC Thunderbolt and Windows/Eclipse:
http://www.nodans.com/index.cfm/2012/2/1/Getting-USB-Device-Drivers-Working-for-HTC-Android-Development
For OSX, Motorola has a USB Link DMG, I'm not sure about HTC though.
Maybe you show give us more information, like
What OS are you using (Windows, Mac, Ubuntu)
Is USB debugging switched on?
Did you restart the adb server
$ adb kill-server
$ sudo adb start-server
* daemon not running. starting it now *
* daemon started successfully *
$ adb devices

Android adb sort of works but can't load to device

I have a zenithink zt-180 tablet connected to my usb port. I can use adb (from the command line) to get a shell command, reboot the tablet, and stuff like that, though I do have to kill and start the server first on the initial connect.
I can also run ddms and it shows me the device threads and statistics and so forth for the tablet.
However, whenever I try to load the helloAndroid example adb and ddms hang. To recover I have to cntr-C out of them, kill the server and then start the server. I can then do the above stated operations, just not load. In Eclips I get an error saying "failed to install HelloAndroid on device 0123456.... : timeout when i try to debug on the device.
I know the application can run because I loaded it onto a USB stick and installed it on the tablet. It ran fine.
What is it about the load program command that is hanging up adb???
Note: USB debugging is enabled in the device. I make sure that only one DDMS and adb are running. All eclips components and the USB driver were loaded two days ago. The tablet is running android 2.1.1
So I did not really fix this but I did find a work around and it's better then USB cable.
Connect to the tablet via the USB cable and issue the adb command "adb tcpip 5555". This command executed and did not crash my adb server. This is key.
Next use the connect command to connect via tcpip.
adb connect :5555
I had firmware 1030 on the ZT-180. Note: I did not have to install adbwireless and I did not have to root it.
credit to the person who came up with these directions: http://www.slatedroid.com/index.php?topic=4316.0
Thanks to all who tried to help
I have had this same effect from a defective USB cable. adb connected just fine, got the prompt on the phone to trust the computer, the device showed up as online when listing adb devices, but any attempt at install whether from the IDE or from the command line caused adb to just hang. Try a different cable.

Categories

Resources