ADB Commands
Adb si trova solitamente in:
Informazioni ottenute da: http://adbshell.com/
Connessione
Questo elencherà i dispositivi connessi; se appare "non autorizzato", significa che devi sbloccare il tuo mobile e accettare la connessione.
Questo indica al dispositivo che deve avviare un server adb sulla porta 5555:
Collegati a quell'IP e a quella Porta:
Se ricevi un errore come il seguente in un software Android virtuale (come Genymotion):
È perché stai cercando di connetterti a un server ADB con una versione diversa. Prova a trovare il binario adb che il software sta utilizzando (vai su C:\Program Files\Genymobile\Genymotion
e cerca adb.exe)
Diversi dispositivi
Ogni volta che trovi diversi dispositivi collegati al tuo computer dovrai specificare in quale vuoi eseguire il comando adb.
Port Tunneling
Nel caso in cui la porta adb sia accessibile solo da localhost nel dispositivo android ma hai accesso tramite SSH, puoi inoltrare la porta 5555 e connetterti tramite adb:
Packet Manager
Installa/Rimuovi
adb install [opzione] <percorso>
adb disinstalla [opzioni] <PACCHETTO>
Pacchetti
Stampa tutti i pacchetti, opzionalmente solo quelli il cui nome del pacchetto contiene il testo in <FILTER>.
adb shell pm list packages [options] <FILTER-STR>
adb shell pm path <PACKAGE>
Stampa il percorso dell'APK del dato .
adb shell pm clear <PACKAGE>
Elimina tutti i dati associati a un pacchetto.
File Manager
adb pull <remote> [local]
Scarica un file specificato da un emulatore/dispositivo al tuo computer.
adb push <local> <remote>
Carica un file specificato dal tuo computer a un emulatore/dispositivo.
Screencapture/Screenrecord
adb shell screencap <filename>
Catturare uno screenshot del display di un dispositivo.
adb shell screenrecord [options] <filename>
Registrazione del display dei dispositivi che eseguono Android 4.4 (API level 19) e versioni superiori.
(press Ctrl-C to stop recording)
Puoi scaricare i file (immagini e video) usando _adb pull_
Shell
adb shell
Ottieni una shell all'interno del dispositivo
adb shell <CMD>
Esegui un comando all'interno del dispositivo
pm
I seguenti comandi vengono eseguiti all'interno di una shell
Processi
Se vuoi ottenere il PID del processo della tua applicazione, puoi eseguire:
E cerca la tua applicazione
Oppure puoi fare
E stamperà il PID dell'applicazione
Sistema
Riavvia il demone adbd con permessi di root. Poi, devi riconnetterti al server ADB e sarai root (se disponibile)
flashing/restoring Android update.zip packages.
Logs
Logcat
Per filtrare i messaggi di un'unica applicazione, ottieni il PID dell'applicazione e usa grep (linux/macos) o findstr (windows) per filtrare l'output di logcat:
adb logcat [opzione] [filtri-spec]
Note: premi Ctrl-C per fermare il monitor
adb logcat -b <Buffer>
dumpsys
dump dei dati di sistema
adb shell dumpsys [options]
Notes: Un dispositivo mobile con le Opzioni Sviluppatore abilitate che esegue Android 5.0 o superiore.
Note: Battery Historian converte quei dati in una visualizzazione HTML. PASSO 1 adb shell dumpsys batterystats > batterystats.txt PASSO 2 python historian.py batterystats.txt > batterystats.html
adb shell dumpsys activity
Backup
Esegui il backup di un dispositivo Android da adb.
Se vuoi ispezionare il contenuto del backup:
Last updated