Install ADB & Fastboot on Ubuntu 21.04
sudo apt install android-tools-adb android-tools-fastboot
adb version
adb devices
References
https://www.linuxbabe.com/ubuntu/how-to-install-adb-fastboot-ubuntu
Daily Notes of a Programmer
sudo apt install android-tools-adb android-tools-fastboot
adb version
adb devices
References
https://www.linuxbabe.com/ubuntu/how-to-install-adb-fastboot-ubuntu
sudo dnf install android-tools
adb reboot recovery
References
https://xiaomiadvices.com/boot-into-custom-recovery-cwm-twrp-android/
https://www.reddit.com/r/Fedora/comments/hbqy2s/adb_on_fedora/
adb shell am force-stop com.my.app.package
References
https://stackoverflow.com/questions/3117095/stopping-an-android-app-from-console
Tap X,Y position:
adb shell input tap 500 1450
Swipe X1 Y1 X2 Y2 [duration(ms)]:
adb shell input swipe 100 500 100 1450 100
LongPress X Y:
adb shell input swipe 100 500 100 500 250
References
https://stackoverflow.com/questions/7789826/adb-shell-input-events
cmd = 'adb exec-out screencap' pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) img_bytes = pipe.stdout.read() img = np.array(Image.frombuffer('RGBA', (960, 540), img_bytes[12:], 'raw', 'RGBX', 0, 1))
adb -s 127.0.0.1:62025 shell ip link show
adb -s 127.0.0.1:62025 shell ifconfig eth1
References
https://stackoverflow.com/questions/1720346/how-to-get-the-android-emulators-ip-address
https://stackoverflow.com/questions/16033900/what-is-the-ip-address-of-android-emulator
set up forwarding of host port 6100 to device port 7100
adb forward tcp:6100 tcp:7100
When your device is trying to access local port 3000, that request will be routed to your laptop’s port 3000.
adb reverse tcp:3000 tcp:3000
References
https://blog.usejournal.com/adb-port-forwarding-and-reversing-d2bc71835d43
list all running apps
adb shell ps
check app is running
adb shell ps "com.klab.captain283.global"
References
https://stackoverflow.com/questions/16691487/how-to-detect-running-app-using-adb-command
adb shell pm list packages -f
References
https://www.aftvnews.com/how-to-determine-the-package-name-of-an-android-app/
Start adb daemon on remote device
adb devices
$ adb devices * daemon not running. starting it now on port 5037 * * daemon started successfully * List of devices attached 5200fe4259bcc000 device
do client to server port forwarding using ssh on port 5037
References
https://dontbelievethebyte.github.io/articles/2015/01/15/debug-remotely-on-android-via-ssh-tunnel/
https://developer.android.com/studio/command-line/adb
https://stackoverflow.com/questions/2604727/how-can-i-connect-to-android-with-adb-over-tcp