Search code examples
androidgoogle-developers-console

Target API30 while blocking Android 11+ devices on Google Console


Is it possible to target API30 while at the same time disallowing access to my app from Android 11+ devices. The Google Console forced an API30 targeting standard on updates and I do not want Android 11+ devices to have access to my app yet.

Thanks.


Solution

  • You can use maxSdkVersion.

    The element is ignored by the android OS itself but apparently the Google Play Store still uses it to filter devices for apps:

    Future versions of Android (beyond Android 2.0.1) will no longer check or enforce the maxSdkVersion attribute during installation or re-validation. Google Play will continue to use the attribute as a filter, however, when presenting users with applications available for download.

    Source: https://developer.android.com/guide/topics/manifest/uses-sdk-element

    You can add it in your app module's build.gradle file:

    android {
        compileSdkVersion 30
    
        defaultConfig {
            ...
            maxSdkVersion 29
            targetSdkVersion 30
            ...
        }
    }