androidandroid-studiocompiler-errorsandroid-actionbaractivitycannot-find-symbol

Why do I get a 'cannot find symbol class' error on my Android import statement (ActionBarActivity) after updating appcompat to 27.1?


Why do I get a 'cannot find symbol class' error on my Android import statement (ActionBarActivity) after updating appcompat to 27.1? I am getting the following error, on the following import statement. Notice the import statement is now greyed out:

Error:(16, 30) error: cannot find symbol class ActionBarActivity

enter image description here

I only updated my build.gradle file (the lines I changed are indicated with double asterisks) so that it now looks like:

    **compileSdkVersion 27**
    **buildToolsVersion '27.0.3'**
    defaultConfig {
        minSdkVersion 23
        **targetSdkVersion 27**
        versionCode 47
        versionName "1.3.35"

        multiDexEnabled true
    }

... 
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:27.1.0'
    compile files('libs/okhttp-3.6.0.jar')
    // major number should always match compileSdkVersion above
    compile files('libs/square-otto-1.3.2.jar')
    compile files('libs/core-3.3.0.jar')
}

Android Studio is fully updated. I'm using 3.0.1


Solution

  • ActionBarActivity was removed around the time of 26.0.0. Switch to AppCompatActivity to continue using appcompat-v7.