Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Build.VERSION.SDK_INT showing incorrect number?

Tags:

java

android

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

like image 387
Chandra Ari Gunawan Avatar asked Apr 24 '19 09:04

Chandra Ari Gunawan


1 Answers

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.

like image 178
Blackbelt Avatar answered Oct 24 '22 22:10

Blackbelt