Skip to content

Instantly share code, notes, and snippets.

@fada21
Last active June 27, 2016 14:34
Show Gist options
  • Save fada21/b074175ef4151714c462 to your computer and use it in GitHub Desktop.
Save fada21/b074175ef4151714c462 to your computer and use it in GitHub Desktop.
## =============================================
# peek on gms service
adb -s emulator-5554 shell dumpsys activity service GcmService --endpoints <package>
## =============================================
# MITM
MY_IP=$(ifconfig wlan0 | sed -rn 's/.*inet addr:(.+) Bcast:.*/\1/p')
mitmproxy -i $MY_IP -p 8888
# proxy enabled emulators
/home/fada21/Android/Sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5X_API_23 -http-proxy localhost:8888
/home/fada21/Android/Sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_9_API_23 -http-proxy localhost:8888
## =============================================
# gradle tasks
run test from console
./gradlew -Pandroid.testInstrumentationRunnerArguments.class=<fullyqualifiedclass> <testtaskname> # just one class
gradle -q ArgosAndroid:dependencies
## =============================================
# Android common commands
adb shell
adb devices
adb -s device_name
adb push some_app.apk /sdcard/Download
adb install some_app.apk
## =============================================
# dex limit
cat PATH_TO_APP/build/intermediates/dex/debug/classes.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
## =============================================
# pull-db from device
PKG=com.example
DB=dbname.db
adb shell "run-as $PKG chmod 755 /data/data/$PKG/databases"
adb shell "run-as $PKG chmod 666 /data/data/$PKG/databases/$DB"
adb shell "rm /sdcard/$DB"
adb shell "cp /data/data/$PKG/databases/$DB /sdcard/$DB"
rm -f /tmp/${DB}
adb pull /sdcard/${DB} /tmp/${DB}
## =============================================
# enable sqlite logging
adb shell setprop log.tag.SQLiteLog V
adb shell setprop log.tag.SQLiteStatements V
adb shell stop
adb shell start
## =============================================
# git lines per dev stats
git ls-tree -r -z --name-only HEAD -- |egrep -z -Z -E '\.(java|xml|gradle)$'| xargs -0 -n1 git blame --line-porcelain |grep "^author "|sort|uniq -c|sort -nr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment