13

I upgraded Android Studio to 1.2 today and I got this error.

The following classes could not be found: android.support.v7.widget.Toolbar (Fix Build Path, Create Class)

My build.gradle contains the following dependencies

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:cardview-v7:22.1.1'
    compile 'com.android.support:recyclerview-v7:22.1.1'
    compile 'com.android.support:appcompat-v7:22.1.1'
}

Would someone please resolve this issue for me?

Farbod Salamat-Zadeh
  • 18,923
  • 18
  • 69
  • 122
Adarsh
  • 827
  • 9
  • 23

3 Answers3

2

This problem can (occasionally) be resolved by invalidating caches

File > Invalidate Caches / Restart > Invalidate and Restart

See below:

Invalidate Caches

Ed George
  • 5,082
  • 2
  • 37
  • 61
1

Android Known Issue: This is bug 170841 which will be fixed in version 1.2.3 of the Android Gradle plugin.

Workaround 1: First manually build the project, then manually sync the project (using the Sync with Gradle files in the toolbar, or from the Tools > Android menu), then finally press Refresh in the toolbar above the layout editor. Workaround 2: Switch the Android Gradle plugin from 1.2.x to 1.1.3 for now. When 1.2.3 is released you can switch back to the 1.2.x versions.

Daniel
  • 588
  • 1
  • 6
  • 23
0

Do you have android-support-v7-appcompat.jar inside your project folder (/lib, /libs etc.)? Delete it! Then try remove it and make Run - Clear project.

SMR
  • 6,568
  • 2
  • 34
  • 56
Tapa Save
  • 4,543
  • 4
  • 31
  • 53