Last active
January 11, 2021 05:05
-
-
Save rocco/0742ee9c332e4ba0d30e to your computer and use it in GitHub Desktop.
cordova/phonegap: helpful adb stuff for android development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list connected devices and emulators | |
# this outputs a list of attached/running [device-id]s | |
adb devices | |
# ---------------------------------------------------- | |
# list all installed apps on device | |
# outputs all [package-id]s of installed apps | |
# from: http://stackoverflow.com/questions/4032960/how-do-i-get-an-apk-file-from-an-android-device#18003462 | |
adb -s [device-id] shell pm list packages | |
# ---------------------------------------------------- | |
# get path to an apk installed on device | |
adb -s [device-id] shell pm path [package-id] | |
# ---------------------------------------------------- | |
# download apk from device to current folder | |
adb -s [device-id] pull /path/to/some.apk | |
# ---------------------------------------------------- | |
# install an apk on device or emulator | |
# helpful options: | |
# '-r' means reinstall the app, keeping its data | |
# '-d' means allow version code downgrade | |
# '-s' means install on SD card instead of internal storage | |
adb -s [device-id] install -r /path/to/your.apk | |
# ---------------------------------------------------- | |
# uninstall an apk from device or emulator | |
adb -s [device-id] uninstall [package-id] | |
# ---------------------------------------------------- | |
# show logs from runnign app | |
# logcat uses filter-specs to filter the global logfile you see when run without params | |
# helpful for cordova are those specs: | |
# CordovaLog:* -> everything from JavaScript via console.log() | |
# CordovaWebViewClient:* -> everything from Java via LOG.d(); | |
# *:S -> other processes:nothing (S = silent) | |
adb -s [device-id] logcat CordovaLog:* CordovaWebViewClient:* *:S | |
# you can also set an ENV var: | |
# export ANDROID_LOG_TAGS="CordovaLog:* CordovaWebViewClient:* *:S" | |
# more info: https://developer.android.com/tools/debugging/debugging-log.html#filteringOutput |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment