Since today, Android Studio can\'t find the AppCompat themes in styles.xml, but for example AppCompatActivity in code does get recognized. My Android Studio version
In Android Studio 3.1.3, the simple work around:
"Sync Project with Gradle Files"
That's because of feature called "build cache" that is enabled by default in build Android Plugin since 2.3.0. It creates files in build cache outside of project folder (in my case -- in \Users\%username%\.android\build-cache) Theese files are intended to be common between your projects.
And then Android Studio is unable to navigate in theese files. That's all.
If you want to disable Build Cache, add android.enableBuildCache=false
to gradle.properties
file. Then restart Android Studio.
more info here: https://developer.android.com/studio/build/build-cache.html#disable_build_cache
I had also the same problem when I upgraded my android studio from 2.2.2 to 2.3 Canary Version. Although the new beta version of 2.3 is released yet it is using the gradle plugin of 2.2.3 which is of stable version.
So just change the classpath dependency in buildscript of build.gradle project level from alpha to 2.2.3 and sync it. It'll resolve the issue or change to the more appropriate version with respect to your channel version.
More on gradle watch this Gradle Recipes for android Ken Kousen - Gradle Summit 2016
https://www.youtube.com/watch?v=4L6wHTVmxGA
I changed my gradle version from
classpath 'com.android.tools.build:gradle:2.3.0'
to
classpath 'com.android.tools.build:gradle:2.2.3'
and it works now!
I went through the same problem when I upgraded to alpha-2.
I looked at this link: http://tools.android.com/recent, but the only thing that worked well was:
Change this: Classpath 'com.android.tools.build:gradle:2.3.0-alpha2'
For this: Classpath 'com.android.tools.build:gradle:2.2.3'
In your build.gradle (Project)
Error should be resolved now.
If that fails, try below-
appcompact-v7
dependency and sync project.appcompact-v7
dependency and sync.