I am trying to use ADB on an Android device itself, so without any host computer. This was working perfectly a couple of days ago, but it suddenly stopped working. As far as I know nothing changed since then (e.g. no apps (un)installed). I could use adb backup -f /sdcard/backup.ab <package-name>
in a terminal emulator and it would start to backup that package. When I try that now, it returns adb: unable to connect for backup
. Investigating using adb devices
returns an empty list. I never bothered to check the devices previously, I just went straight to my adb command, because everything was working.
This was on an HTC Desire running Android 4.4.2, ADB version 1.0.31. Using ADB from my PC with this phone is working perfectly, but this is not what I want.
What I have tried
- I have tried to perform the same actions on different devices (Asus PadFone 2 on 4.4.2, Samsung Galaxy Note GT-N7000 on 4.4.2, Sony Xperia S on 4.1.2.) but
adb devices
returns an empty list on all of them. I am starting to wonder why this has worked on my HTC Desire in the first place. - Searching Google and Stack Overflow, but most (if not all) results refer to a driver problem or any other problem involving a host computer.
adb kill-server
+adb start-server
about a hundred times, as well asstop adbd
+start adbd
.- Turning 'USB Debugging' off and on in the Settings, as well as revoking access to previously authorized computers. (However, in the working situation, I never got any RSA key verification prompt.)
adb -a devices
-> empty list.adb usb
->error: device not found
.- Trying to restart adb(d) in TCP mode is unsuccessful (even though this was not necessary in the working situation).
adb tcpip 5555
returnserror: device not found
. getprop
returns no entry namedservice.adb.tcp.port
andsetprop service.adb.tcp.port 5555
silently fails. (Checking afterwards usinggetprop service.adb.tcp.port
returns nothing. Doesn't this need root?)adb connect localhost
returnsunable to connect to localhost:5555
.- When the daemon starts, it starts on port 5038 (when using ADB from my PC it starts on 5037).
adb connect localhost:5038
returnsconnected to localhost:5038
. Howeveradb devices
still returns an empty list, andadb backup
returnsadb: unable to connect for backup
. Furthermoreadb shell
returnserror: device not found
andadb get-state
returnsunknown
. So no success here either. - Finding my local ip using
getprop dhcp.wlan0.ipaddress
(returns 192.168.1.xx) and thenadb connect 192.168.1.xx
returnsunable to connect to :5555
.adb connect 192.168.1.xx:5038
->unable to connect to :5038
. UsingADBHOST=192.168.1.xx adb start-server
has no effect on these outcomes. - One of the few search results that was actually somewhat relevant is this thread on the AOSP Issue Tracker. Yet, it describes a problem where, after using
setprop service.adb.tcp.port 5555
,adb devices
at least shows a device, however offline (namelylocalhost:5555 offline
). Somewhat near the end of the thread a solution is reached, which involves changing the $HOME directory so as to change where the RSA keys are saved, e.g.HOME=/sdcard
. It is then necessary to append the public key to /data/misc/adb/adb_keys usingcat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys
. However, I presume this needs root? Also, all of this was not necessary in the working situation so I doubt the solution to my problem is to be found in this direction. This article, derived from the thread at AOSP's Issue Tracker, does not speak of appending the public key. However, the approach mentioned is unsuccessful. netstat
returns (among others):Proto: tcp
Recv-Q: 0
Send-Q: 0
Local Address: 127.0.0.1:5038
Foreign Address: 0.0.0.0:*
State: LISTEN
ps
shows an/sbin/adbd
process as well as anadb
process:- USER: shell PID: 92 PPID: 1 VSIZE: 3624 RSS: 264 WCHAN: ffffffff PC: 00000000 S NAME: /sbin/adbd
- USER: u0_a57 PID: 9754 PPID: 1 VSIZE: 3016 RSS: 988 WCHAN: ffffffff PC: 4014f768 S NAME: adb
- (Commands executed from the terminal are executed as USER: u0_a57.)
I guess that's pretty much it.
I am looking for a solution where no root is needed, as it was not needed when I had it working before. I hope my situation and question is clear. Please let me know if my question needs improving, as this is my first time posting on Stack Overflow. Hopefully someone can help me with this. Thanks in advance!