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

Alyoshak
  • 2,696
  • 10
  • 43
  • 70

1 Answers1

5

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

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Indeed that is the solution. They will allow me to accept your answer as correct in 5 min. Thank you for your service to this community. You've helped me several times. Maintaining a certain Android app is only one of my duties so it is impossible for me to keep up with everything Android as if it were my full-time job. – Alyoshak Mar 16 '18 at 16:01