Burhan Burhan - 1 year ago 61
Android Question

Error: cannot find symbol variable LOLLIPOP

I have seen many examples in different android libraries about detecting if device is LOLLIPOP supported or not. But when I use it in my app, it is throwing the following error:

Error:(20, 60) error: cannot find symbol variable LOLLIPOP

For example my source code is:

static boolean isLollipop() {

I am using the latest version of Android Studio with all packages updated and installed.

Error is on this statement:


Also when I check options of
does not exist in that list.

Answer Source

it seems to that you're using old build tools or you're missing some libraries.

I pasted your code into my Android Studio and it works.

Please compare your build.gradle with this one:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23           //THIS GUY
    buildToolsVersion "23.0.2"    //THIS GUY

    defaultConfig {
        applicationId "com.example.piotr.myapplication"
        minSdkVersion 15
        targetSdkVersion 23     //THIS GUY
        versionCode 1
        versionName "1.0"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1' //THIS GUY
    compile 'com.android.support:design:23.1.1'

I've already matched parts which might be important to your code.

Hope it help