9.5 ADB Install APK Package


Be careful when installing arbitrary Android packages from the Internet. Only do so if they are from a trustworthy source and have been independently audited. The example here downloads the open source F-Droid client for Android.

$ wget https://f-droid.org/FDroid.apk
--2020-01-22 11:41:07--  https://f-droid.org/FDroid.apk
Resolving f-droid.org (f-droid.org)...,,
Connecting to f-droid.org (f-droid.org)||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7568874 (7.2M) [application/vnd.android.package-archive]
Saving to: 'FDroid.apk'

FDroid.apk   100%[=============================>]   7.22M  1.30MB/s    in 7.2s    

2020-01-22 11:41:16 (1024 KB/s) - 'FDroid.apk' saved [7568874/7568874]

Installation is then effected using the install command:

$ adb install FDroid.apk

Check the Android device to see that the application has indeed been installed.

If the app supports installation on the SD Card (the primary storage can be prone to filling up) then the -s option can be used.

The -r option forces the re-installation or update of an existing app.

Not tested, but we can identify a particular package to uninstall:

$ adb uninstall au.com.bitbot.phonetowers
$ adb shell 'pm list packages -f' |
  sed -e 's/.*=//' |
  sed 's/\r//g' |
  grep "com.foobar" |
  while read pkg; do adb uninstall $pkg; done;

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0