ADB Commands
Adb zazwyczaj znajduje się w:
Informacje uzyskane z: http://adbshell.com/
Połączenie
To będzie lista podłączonych urządzeń; jeśli "nieautoryzowane" się pojawi, oznacza to, że musisz odblokować swój telefon i zaakceptować połączenie.
To wskazuje urządzeniu, że musi uruchomić serwer adb na porcie 5555:
Połącz się z tym adresem IP i tym portem:
Jeśli otrzymasz błąd podobny do poniższego w wirtualnym oprogramowaniu Android (takim jak Genymotion):
To dlatego, że próbujesz połączyć się z serwerem ADB o innej wersji. Po prostu spróbuj znaleźć binarkę adb, której używa oprogramowanie (przejdź do C:\Program Files\Genymobile\Genymotion
i wyszukaj adb.exe)
Kilka urządzeń
Kiedy znajdziesz kilka urządzeń podłączonych do twojego komputera, będziesz musiał określić, na którym chcesz uruchomić polecenie adb.
Port Tunneling
W przypadku, gdy port adb jest dostępny tylko z localhost na urządzeniu z androidem, ale masz dostęp przez SSH, możesz przekierować port 5555 i połączyć się przez adb:
Menedżer Pakietów
Instalacja/Deinstalacja
adb install [opcja] <ścieżka>
adb uninstall [options] <PACKAGE>
Pakiety
Wyświetla wszystkie pakiety, opcjonalnie tylko te, których nazwa pakietu zawiera tekst w <FILTER>.
adb shell pm list packages [options] <FILTER-STR>
adb shell pm path <PACKAGE>
Wyświetla ścieżkę do APK podanego .
adb shell pm clear <PACKAGE>
Usuń wszystkie dane związane z pakietem.
File Manager
adb pull <remote> [local]
Pobierz określony plik z emulatora/urządzenia na swój komputer.
adb push <local> <remote>
Prześlij określony plik z komputera do emulatora/urządzenia.
Screencapture/Screenrecord
adb shell screencap <filename>
Robienie zrzutu ekranu wyświetlacza urządzenia.
adb shell screenrecord [options] <filename>
Nagrywanie wyświetlacza urządzeń działających na Androidzie 4.4 (poziom API 19) i wyższych.
(press Ctrl-C to stop recording)
Możesz pobrać pliki (obrazy i filmy) używając _adb pull_
Shell
adb shell
Uzyskaj dostęp do powłoki wewnątrz urządzenia
adb shell <CMD>
Wykonaj polecenie wewnątrz urządzenia
pm
Następujące polecenia są wykonywane w obrębie powłoki
Procesy
Jeśli chcesz uzyskać PID procesu swojej aplikacji, możesz wykonać:
I wyszukaj swoją aplikację
Lub możesz zrobić
I wydrukuje PID aplikacji
System
Restartuje demona adbd z uprawnieniami roota. Następnie musisz ponownie połączyć się z serwerem ADB i będziesz rootem (jeśli dostępny).
flashing/restoring Android update.zip packages.
Logs
Logcat
Aby filtrować wiadomości tylko jednej aplikacji, uzyskaj PID aplikacji i użyj grep (linux/macos) lub findstr (windows), aby filtrować wyjście logcat:
adb logcat [option] [filter-specs]
Notes: naciśnij Ctrl-C, aby zatrzymać monitor
adb logcat -b <Buffer>
dumpsys
zrzut danych systemowych
adb shell dumpsys [options]
Notes: Urządzenie mobilne z włączonymi Opcjami dewelopera działające na Androidzie 5.0 lub wyższym.
Notatki: Battery Historian przekształca te dane w wizualizację HTML. KROK 1 adb shell dumpsys batterystats > batterystats.txt KROK 2 python historian.py batterystats.txt > batterystats.html
adb shell dumpsys activity
Backup
Zrób kopię zapasową urządzenia z systemem Android za pomocą adb.
Jeśli chcesz sprawdzić zawartość kopii zapasowej:
Last updated