title: Is there a way to emulate a Android OS upgrade scenario on AVD emulator?
body: <p>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).</p>
  <p>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?</p>
  <hr />
  <p>What I essentially want to test out is this:</p>
  <p>Let's say that I have android with API level 21 installed on a device. I install an app with <code>maxSdkVersion</code> 21 on it. Now my device upgrades to API level 22. What will happen to my app?</p>
  <ul>
  <li>Will the OS silently get my app uninstalled and keep it that way?</li>
  <li>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?</li>
  <li>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?</li>
  </ul>
  <hr />
  <p>The <a href="https://developer.android.com/guide/topics/manifest/uses-sdk-element.html" rel="noreferrer">Android Developer Docs</a> recommends that using <code>maxSdkVersion</code> is not a good idea since <strong>in some cases</strong> uninstalls would happen.</p>
  <blockquote>
  <p>An application declaring maxSdkVersion=&quot;5&quot; 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 normally. 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.</p>
  <blockquote>
  <p>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 <strong>result in your application being removed from users' devices after a system update</strong> 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.</p>
  </blockquote>
  </blockquote>
  <p>What I also want to figure out is what happens next. And what does &quot;in some cases&quot; essentially mean?</p>