Skip to content

Instantly share code, notes, and snippets.

@0neel
Last active April 18, 2023 20:47
Show Gist options
  • Save 0neel/223b93da1b630000e61042f67c0f972a to your computer and use it in GitHub Desktop.
Save 0neel/223b93da1b630000e61042f67c0f972a to your computer and use it in GitHub Desktop.
Various Android terminal tools
# preview
# Starts the emulator with a manually set dns address
emulator -avd Nexus_5_API_16 -dns-server 8.8.8.8
# Makes gradlew executable (required by Jenkins and other unix systems)
git update-index --chmod=+x ./gradlew
# Remount linux file system
mount -o rw,remount,rw /system # make read-write
mount -o ro,remount,ro /system # make read-only
# package name list
adb shell 'pm list packages -f' | sed -e 's/.*=//' | sort
# start app
adb shell monkey -p <place_package_name_here> 1
# get package apk path
adb shell pm list packages -f <package_name>
# Get package info
adb shell dumpsys package <package_name>
# Get running processes
adb shell ps
# Connect network device
adb connect <device_ip>
# Install apk
adb install -r <package_name>.apk
# Make screenshot
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png
adb shell rm /sdcard/screen.png
# Reinstall with settings saving
adb shell pm uninstall -k <package_name>
adb install -r <apk_path>
# Open Developer settings
adb shell am start -n com.android.settings/.DevelopmentSettings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment