Installing an APK Onto an Android Device

31st August 2017 | Programming

Several years ago I was doing some Android development. One of the things I appreciated the most about Android was the relative simplicity of being able to install apps to a device, unlike iOS which requires jumping through numerous hoops (although it is getting better with Xcode 9).

As a refresher for myself (and good documentation in the case I need to repeat these steps sometime in the future), here are the steps to take to install an APK app bundle onto an Android device.

  1. Install the platform tools (such as adb). Download the platform tools from Google's website.
  2. Unzip the downloaded file.
  3. On the Mac, copy any wanted utilities to the /usr/local/bin folder (create the folder if necessary). For this purpose, adb needs to be copied over.
  4. On an Android device, make sure the Developer mode is enabled. If not, go to Settings > About Phone/Tablet, then tap on the Build Number seven times to enable the Developer mode (otherwise, adb won't be able to see the device).
  5. Ensure that USB Debugging is also enabled in the Developer Options
  6. Verify that the device is visible with the command: adb devices
  7. To install the apk file onto the device: adb install -r path/to/apk_file
  8. If there are multiple devices or emulators connected, the APK can be installed to a specific device: adb -s FA3C3S903152 install -r path/to/apk_file
  9. If needed, uninstall the app with the command: adb uninstall com.example.appname

Note: If the app you try and load an app which requires a higher API version than what is on the phone, you'll see an error like the following:

$ adb install -r example.apk 
example.apk: 1 file pushed. 3.1 MB/s (8255173 bytes in 2.560s)
	pkg: /data/local/tmp/example.apk