GINGERBREAD error cannot be resolved or is not a field

I want to programmatically check the current version of Android and execute part of the code if the version is higher than Gingerbread, but when I try to use

android.os.Build.VERSION_CODES.GINGERBREAD

eclipse shows the following error

GINGERBREAD cannot be resolved or is not a field

what could be the reason for this?

+6
source share
1 answer

You need to set the build target (e.g. Project> Properties> Android) to API level 9 or higher to refer to this symbol.

Currently, you usually want to set the build target to something pretty current (e.g. API level 18), using Lint to point to anything you reference above your android:minSdkVersion .

+18
source

Source: https://habr.com/ru/post/953263/


All Articles