top of page
  • admin

Android Shell Tricks: Using Mass Device Provisioning as an Example, Part 2


Packages

Now let’s install an app:

adb install MyAwesomeApp.apk

Uninstalling an app is a little more work, because the app to be removed has to be specified by its package name, not the APK filename, which requires a little guessing. First let’s get the list of APKs installed:

adb shell pm list packages
package:com.google.android.ears
package:com.android.launcher
package:com.android.defcontainer
package:com.google.android.exchange
package:com.subsplash.esv
package:com.android.providers.partnerbookmarks
package:com.android.contacts
package:com.hotrod.utility.rfsignaltrackereclair
package:com.android.phone
package:com.dominospizza
package:com.urbanspoon
package:com.android.calculator2
package:com.google.android.apps.walletnfcrel
package:com.android.htmlviewer
package:com.android.cellbroadcastreceiver
package:com.google.android.gsf.login
package:com.android.bluetooth
package:com.android.providers.calendar
package:com.zynga.words
package:com.google.android.email
package:com.awesome.stuff
...

Looking through the list, com.awesome.stuff seems likely to be the package name for MyAwesomeApp.apk. So let’s delete it:

adb uninstall com.awesome.stuff
Success

You can also do the same thing while you’re in the Android shell (rather than executing an adb command on the host). This might be useful in a provisioning script running on the device:

shell@mako:/ $ pm install /sdcard/MyAwesomeApp.apk
pkg: /sdcard/MyAwesomeApp.apk
Success

shell@mako:/ $ pm uninstall com.awesome.stuff
Success

What if you want to make it harder for someone to dump the contents of your apk? Install it encrypted (locked):

adb install -l MyApp.apk

The pm command has a ton of other options; run adb shell pm to see what it can do.

177 views

Recent Posts

See All
bottom of page