Is there a way to emulate a Android OS upgrade scenario on AVD emulator?-ThrowExceptions

Exception or error:

I’ve been trying to simulate a scenario where I want to check how my Android app behaves after an OS update. But I don’t have access to physical device at the moment where I can run an actual OS update scenario, so I have to resort to trying it out on android emulator (AVD).

Is there a way I can update the OS on AVD as if it were a real phone, and be able to see how my app would behave?


What I essentially want to test out is this:

Let’s say that I have android with API level 21 installed on a device. I install an app with maxSdkVersion 21 on it. Now me device upgrades to API level 22. What will happen to my app?

  • Will the OS silently get my app uninstalled and keep it that way?
  • Will the OS check with play store to see if a build of my app with a supported SDK level is available and download and install that instead?
  • Will the OS at least give me a visual warning or prompt that this particular app is not compatible on the device anymore and tell me what I could do next?

The Android Developer Docs recommends that using maxSdkVersion is not a good idea since in some cases uninstalls would happen.

An application declaring maxSdkVersion=”5″ in its manifest is published on Google Play. A user whose device is running Android 1.6 (API Level 4) downloads and installs the app. After a few weeks, the user receives an over-the-air system update to Android 2.0 (API Level 5). After the update is installed, the system checks the application’s maxSdkVersion and successfully re-validates it. The application functions as normal. However, some time later, the device receives another system update, this time to Android 2.0.1 (API Level 6). After the update, the system can no longer re-validate the application because the system’s own API Level (6) is now higher than the maximum supported by the application (5). The system prevents the application from being visible to the user, in effect removing it from the device.

Warning: Declaring this attribute is not recommended. First, there is no need to set the attribute as means of blocking deployment of your application onto new versions of the Android platform as they are released. By design, new versions of the platform are fully backward-compatible. Your application should work properly on new versions, provided it uses only standard APIs and follows development best practices. Second, note that in some cases, declaring the attribute can result in your application being removed from users’ devices after a system update to a higher API Level. Most devices on which your application is likely to be installed will receive periodic system updates over the air, so you should consider their effect on your application before setting this attribute.

What I also want to figure out is what happens next. And what does “in some cases” essentially mean?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *