Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nhancv/64740e8477052f943891caf317fd42d2 to your computer and use it in GitHub Desktop.
Save nhancv/64740e8477052f943891caf317fd42d2 to your computer and use it in GitHub Desktop.

setup adb

Add platform-tools to your path

echo 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile
echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools' >> ~/.bash_profile

Refresh your bash profile (or restart your terminal app)

source ~/.bash_profile

Start using adb

adb devices

install apk

You can use the code below to install application from command line

adb install example.apk

this apk is installed in the internal memory of current opened emulator.

adb install -s example.apk

this apk is installed in the sd-card of current opened emulator.

You can also install an apk to specific device in connected device list to the adb.

adb -s emulator-5554 install myapp.apk

install [options] Installs a package (specified by ) to the system. Options:

-l: Install the package with forward lock.
-r: Reinstall an exisiting app, keeping its data.
-t: Allow test APKs to be installed.
-i <INSTALLER_PACKAGE_NAME>: Specify the installer package name.
-s: Install package on the shared mass storage (such as sdcard).
-f: Install package on the internal system memory.
-d: Allow version code downgrade.

uninstall [options] Removes a package from the system. Options:

-k: Keep the data and cache directories around after package removal.

ref: Set up adb on Mac OS X Install an apk file from command prompt?

setup git default editor

Step one:

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

Step two:

git config --global core.editor "subl -n -w"

or

git config --global core.editor "'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' -n -w"

make osx appswitcher display on all moniter

defaults write com.apple.Dock appswitcher-all-displays -bool true; killall Dock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment