Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hwd6190128/fb743e9beabba8c0c9013aca21c75c97 to your computer and use it in GitHub Desktop.
Save hwd6190128/fb743e9beabba8c0c9013aca21c75c97 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
@Azyman
Copy link

Azyman commented Feb 15, 2023

Hi, am installing the .apk files successfully but I am not seeing it on the device:

admins-MacBook-Pro:platform-tools akavhuru$ ./adb -s emulator-5554 install /Users/akavhuru/Downloads/com.opera.mini.android-7.6.4-34-minAPI3.apk
Performing Streamed Install
Success
admins-MacBook-Pro:platform-tools akavhuru$

but I cant see the app on the device

@hwd6190128
Copy link
Author

Hi, am installing the .apk files successfully but I am not seeing it on the device:

admins-MacBook-Pro:platform-tools akavhuru$ ./adb -s emulator-5554 install /Users/akavhuru/Downloads/com.opera.mini.android-7.6.4-34-minAPI3.apk Performing Streamed Install Success admins-MacBook-Pro:platform-tools akavhuru$

but I cant see the app on the device

have u checked Settings > Apps > See all x apps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment