Last active
November 26, 2018 03:10
-
-
Save kingideayou/0c621c6c086131cce5d46b479931fab9 to your computer and use it in GitHub Desktop.
Terminal Shortcuts
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
export PATH=$PATH:/Users/UserName/Library/Android/sdk/platform-tools:/Users/UserName/Library/Android/sdk/tools #replace UserName with your userName | |
export appId='<your.app.id>' | |
export mainActivityName='<your.main.activity.name>' | |
export buildVariantTarget='<iD>' # Default to installDebug (iD) ; Replace it with your default buildVariantType | |
alias gn='./gradlew' | |
alias la='ls -l' # prints files in current folder along with date modified & permissions. | |
alias l='cd ..' | |
alias ll='cd ../..' | |
alias lll='cd ../../..' | |
alias llll='cd ../../../../' | |
alias cppath='pwd | pbcopy' # copy current path to clipboard | |
alias o='open .' # open Finder window from current path , very useful | |
alias c='clear' | |
alias opent='open -a TextEdit ' # open file with textedit instead of vim | |
alias latestapkname='ls -tr | grep '.apk' | tail -1 | pbcopy' # copy latestApk file name in current folder to clipboard. | |
function sta() { adb shell am start -n "$appId"/"$mainActivityName";} # start app | |
function stp() { adb shell am force-stop "$appId";} # force stop app | |
function clr() { adb shell pm clear "$appId";} # clear data of app | |
function uns() { adb uninstall "$appId";} # uninstall app | |
function bld() { gn "$buildVariantTarget" ; sta; } # Build with buildVariantTarget flavor then install App then start it | |
function bldu() { uns; gn "$buildVariantTarget"; sta; } # Uninstall App then Build with buildVariantTarget flavor then install App & then start it | |
function updateappid() { if [ -z != $1 ];then appId="$1";fi; } # use updateAppId com.random.otherapp to change it for that tab. | |
function updatemainactivity() { if [ -z != $1 ];then mainActivityName="$1";fi; } | |
function updatebuildtype() { if [ -z != $1 ];then buildVariantTarget="$1";fi; } | |
function printvariables() { echo "appId = $appId | |
mainActivityName = $mainActivityName | |
buildVariantTarget = $buildVariantTarget"; } | |
alias adbkill='adb kill-server' | |
alias adbstart='adb start-server' | |
alias devices='adb devices' | |
alias ins='uns && adb install ' # Uninstall App then install with existing app path ; ins <pathToApk.apk> | |
alias insr='adb install -r ' | |
function upglatest() { latestapkname; upg $(pbpaste); sta; } # Upgrade app with latest updated apk in current folder | |
alias gitrev='git reset --soft HEAD^' # revert your last commit from your branch | |
alias gitcurrent='git rev-parse --abbrev-ref HEAD | pbcopy' # copy current branch name to clipboard , useful when giving PR's | |
alias gitdelbranch='git branch | grep "<branchpattern>" | xargs git branch -D' # deletes git local branches matching pattern, to reduce clutter of branches. | |
alias dispalytime='adb logcat -s ActivityManager | grep "Displayed"' | |
alias logs='adb logcat AndroidRuntime:E *:S' # prints only Crash logs, if AndroidStudio is not working use this command. | |
alias text='adb shell input text ' # to enter text input to your device |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment