Huy Minh Ha

Software development, Tech and other stuff

Fri 03 October 2014

Android CLI tool cheatsheet

Posted by Ha.Minh in Programming   

ANDROID CLI CHEATSHEET

Read log

    adb logcat
    adb logcat -v time

    adb logcat *:V # Get all message in verbose mode
    adb logcat xxxxxxx:V *:S # Get all message starts with xxxxx

    # Log by pid
    adb logcat | grep `adb shell ps | grep com.example.package | cut -c10-15`

List package

    adb shell pm list package
    adb shell pm path com.example.someapp
    adb pull /data/app/com.example.someapp-2.apk

Run a particular intent

    # Start by activity name
    adb shell 'am start -n com.qooapp.qoohelper/.activity.WelcomeActivity'

    # add environment variable
    adb shell 'am start -a $(MYPACKAGEID).RUN -e server http://$(MYIP):$(MYPORT) -e game $(game) -e nativeLog $(MYNATIVELOG)'

Install / Uninstall

    adb install file.apk
    adb install -r file.apk # replace

    # Install to a specific device
    adb -s "deviceIDfromlist" install file.apk

    adb shell am start -a android.intent.action.DELETE -d package:<your app package>

Extracting APK file

    apktool d /path/to/apk
    open res/values/strings.xml

References


    
 
 

Comments