index









zhaoyatao.com

android notes

android debug bridge(adb)









// source of the note
https://www.youtube.com/watch?v=uOPcUjVl2YQ




// more info
adb devices -l




// more divice, e.g.android phone's usb debug mode
adb -s emulator-5554 shell





// print out all folders, files in your android system
ls



// exit shell mode
exit




// i am who?
whoami





// change diractor to sdcard: enter to Secure Digital(SD) card folder
cd sdcard



// create a new file named: temp.txt
touch temp.txt




// write hello to temp.txt
echo "hello" > temp.txt




// read temp.txt file in terminal
cat temp.txt





// create a new file
vim temp_del.txt


// vim is a editor
sudo apt install vim



// insert something in INSERT mode
i


// save insert, quit vim
:wq




// use adb to tranport local file to sdcard folder
adb push temp_del.txt /sdcard




// delete temp_del.txt file
rm temp_del.txt




// pull the temp_del.txt from sdcard folder to current folder
adb pull /sdcard/temp_del.txt .




// catch a android screenshot to current folder named: pic.png
adb exec-out screencap -p > ./pic.png




// open current folder
open .



// open current up-folder
open ..



// change current diractor to a up-diractor
cd ..



// record a video
adb shell screenrecord "/sdcard/vidfile.mp4"


// kill a current command
Crtl + C




// pull the video to the current folder
// do not delete origin file
abd pull /sdcard/vidfile.mp4 .





// touch phone without finger
adb shell input tap 538 1099




// open INPUT on phone: Show taps, Pointer location




// give txt to phone
adb shell input text "Hello"




// show all installed packages
adb shell pm list packages



// search bk package
adb shell pm list packages | grep bk





// in adb shell mode, e.g. generic_x86_arm:/ $
run-as bk.yt.example






// show current folder location
pwd





// clear terminal
clear




// clear terminal
Ctrl + L




// show all package activity
adb shell dumpsys activity




// search the package we are looking for
adb shell dumpsys activity "bk.yt.example"





// edit the package
adb shell dumpsys activity "bk.yt.example" | vim -




// vim quit
:q





// force vim quit without save
:q!










project: install software on your home television(TV)


// linux advanced packaging tool(apt) update
sudo apt update && sudo apt upgrade





// windows user maybe need to install adb.exe, and download, run it.
adb download page
// in the extracted(unzip) folder press F4, or in the folder path: clear path, type cmd. it will open cmd.exe so you can type adb to run it
// linux user run this in terminal:
sudo apt install adb





// make sure your computer and TV at same WiFi/router






// check out your TV's Internet Protocol(IP) address in the setting of TV
// if your TV's adb switch is off: enter TV information, try press your remote controler this: upupdowndownleftrightleftright or upupdowndownleftleftrightright
// try to connect your home TV
adb connect 192.168.50.65






// maybe port is 5555 or not
adb connect 192.168.50.65:5555





// check out connect
adb devices





// enter shell mode
adb shell


// quit shell mode
exit



// install software
adb install xxx.apk




Back to Top