Chandra Ari Gunawan
Chandra Ari Gunawan

Reputation: 183

Why Build.VERSION.SDK_INT showing incorrect number?

I'm developing an android application and want to support android Q Beta. So I tried android Q beta on my pixel 1.

But, when I want to check specific SDK version, it showing incorrect number.

I have read this and for android Q, SDK_INT should be 10000 (because it will similar with constant_value CUR_DEVELOPMENT).

I tried debugging to get SDK_INT number with this code :

CustomLog.v("Build", "build int : " + Build.VERSION.SDK_INT + " | Curr Dev : " + Build.VERSION_CODES.CUR_DEVELOPMENT + " | Build baseOS: " + Build.VERSION.BASE_OS);
CustomLog.v("Build", "preview sdk int : " + Build.VERSION.PREVIEW_SDK_INT + " | Code Nanme : " + Build.VERSION.CODENAME + " | Version Q : " + Build.VERSION_CODES.Q); 

I expect the output Build.VERSION.SDK_INT to be 10000, but the actual output is 28, which is constant_value for android P.

This is the log in my logcat:

Log Cat

and this is information the devices:

Pixel Information

Upvotes: 5

Views: 1849

Answers (1)

Blackbelt
Blackbelt

Reputation: 157467

That's normal - and it is gonna be this way until Q is officially released I guess. If you want to test against Q you could use

BuildCompat#isAtLeastQ()

As point out by CommonsWare, The real value (29) should start appearing around Q Beta 4 when the APIs are supposed to be finalized.

Upvotes: 6

Related Questions