Tuesday, October 01, 2013

Android Dev Tip: forcing a fresh install of an app from the command line

My usual recipe for installing and testing an app on an Android device is:

  make bin/SomeApp.apk ; adb.exe install -r bin/SomeApp.apk

The -r re-installs the app if necessary and keeps existing app data in place.

However, to test a new feature of an app I needed to start from scratch every time. Not too tricky, I just changed the recipe above to:

 make bin/SomeApp.apk; \
   adb.exe uninstall my.package.SomeApp ; \
   adb.exe install bin/SomeApp.apk

However, it may not be obvious your package name was (for me, using Adobe AIR, it wasn't).

Using adb that's easy to find, too. Just run:

   adb.exe shell "pm list packages" |grep -i someapp

This will spit out something like: package:my.package.SomeApp. Strip off "package:" at the start of the line, and you've got your full package name.

This does make me wonder what other tricks adb.exe shell, and the command line Package Manager (pm) may offer. But that's the topic for another blog post, another day.

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails