Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error GINGERBREAD cannot be resolved or is not a field

I want to programmatically check the current android version and execute a piece of code if the version is higher than Gingerbread but when I try to use

android.os.Build.VERSION_CODES.GINGERBREAD

eclipse is showing following error

GINGERBREAD cannot be resolved or is not a field

so what may be the reason for that?

like image 943
ofnowhere Avatar asked Sep 05 '13 17:09

ofnowhere


1 Answers

You need to set your build target (e.g., Project > Properties > Android) to API Level 9 or higher to reference that symbol.

Nowadays, you usually want to set that build target to something fairly current (e.g., API Level 18), using Lint to point out anything that you reference that is higher than your android:minSdkVersion.

like image 106
CommonsWare Avatar answered Sep 27 '22 23:09

CommonsWare