Search code examples
androidupgradecompatibilityandroid-7.0-nougat

How do I ensure my published Android app works with new updates?


I recently published a simple alarm app on the Play Store, utilizing Gradle, with compileSdkVersion = 23, targetSdkVersion = 23, and minSdkVersion = 15.

I had thought based on Android design principles that even if users upgrade to Android 7.0 my app would still work fine without my having to make any updates, but it turns out this is not the case. Instead whenever the alarm is supposed to go off the app crashes. I tried to research the issue including looking at the new behavior changes in 7.0, but there was nothing specifically I could find that would cause the issue. The only potential solution I saw was to change the compileSdkVersion to the latest (which would be 24) but I'm not sure that should be it.

The app is simple enough that ideally I would not want to update it unless the client requested a specific change or there was a bug that popped up. So my question is: how do I ensure forwards compatibility of my app such that I do not have to release an update for every new version of Android that is released, and this is even possible? The app works fine on phones that use Ice Cream Sandwich to Marshmallow but it no longer works when the phone is upgraded to Nougat. Thankfully the download base is small enough that I am the only user currently on Nougat but I would like to fix the issue before any other users experience trouble.

I am happy to share code/details if needed but I have kept it out for now in hopes that I have just missed something simple.

Thanks!


Solution

  • The only potential solution I saw was to change the compileSdkVersion to the latest

    That has no effect on runtime behavior, unless you also change your Java code to do something different on the newer devices (e.g., start using some API Level 24 classes and methods).

    how do I ensure forwards compatibility of my app such that I do not have to release an update for every new version of Android that is released

    "Ensure" is impossible for any app of significant size. There are too many variables.

    Usually, forwards compatibility "just works". Many behavior changes on new versions of Android only take effect when you raise your targetSdkVersion. For example, I have several hundred sample apps in my book, and rarely will an app outright crash on a new version of Android where it worked before. While each of those sample apps are fairly trivial, combined they exercise a fair bit of the Android SDK.

    Those places where I have run into problems is because what I thought was the proper approach to solving some problem turned out to be wrong. However, on older versions of Android, it was wrong in a way that didn't crash. Fixing the app to solve the problem the correct way usually clears up the problem on old and new versions of Android.

    But, Android has bugs. Regressions — places where X used to work and is supposed to work but now no longer works — come with every substantial Android release. I blog about them when I find out about them. And, in these cases, there is little recourse but to change your code, if the regression affects you.