Looking for this?
(Click image to enlarge)
You're doing things incorrectly. First, a bit of basics:
- adb is a bridge which helps in communicating with a slave (an Android device) from a client on host machine (typically a PC) through a server running on host machine.
- A slave has a daemon named adbd which has to running in order for slave to communicate back.
When you try to run an adb command from terminal emulator app, the adb client expects an another Android connected to host Android device through USB. Since that is not the case, you get
error: device not found. If you connect an another Android device through OTG and have USB debugging activated there, you would/might be able to run adb successfully. At least I was able to.
A simplest workaround is to have adbd listening on TCP as well. In that case, you can connect to localhost and get the job done. There is no way a process with ordinary privilege in Android can restart adbd to listen on TCP. The official way on stock Android is to do
adb tcpip PORT from host machine. In this case, you would need a PC with adb setup there. Connect the device to PC and execute from PC, the command:
adb tcpip PORT # PORT is port number in your device to listen for and establish connection on TCP. Default port is 5555.
You can now unplug the device. As long as you don't reboot the device or disable USB debugging from Developer options, adbd would continue to run and listen for connection on your supplied PORT.
Don't worry about security. While adbd would receive connection from local Wi-Fi network, one cannot successfully connect to your device unless you authorize debugging by accepting their fingerprint.
Anyhow, in your terminal emulator, execute
adb connect localhost:PORT
You would be required to accept a fingerprint. If you followed instructions carefully, you would get the output:
connected to localhost:PORT
Now you can run your backup command. But honestly, it is not clear to me what you're trying to achieve. If backup alone is the goal, then Helium app might be able to help.
In case you're not aware of this, not all the apps can be backed up using adb.