Build.VERSION.SDK_INT
returns 28 instead of 29 when running on Android Q emulator. Is there anything I am missing? I am trying to add logic specifically for Android Q but I do not know how to determine this version correctly.
app.gradle file contains
targetSdkVersion = 'Q'
compileSdkVersion = 'android-Q'
Before the API is finalized and officially becomes API 29 (where you'd use compileSdkVersion 29
, etc), you must use BuildCompat.isAtLeastQ()
:
Checks if the device is running on a pre-release version of Android Q or newer.
Note: This method will return false on devices running release versions of Android. When Android Q is finalized for release, this method will be deprecated and all calls should be replaced with
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
.