I am tryng out Android Studio instead of Eclipse. I install it and then start a completely new project and follow the wizard. I add no code of my own.
Then, I right-
"File" -> "Invalidate Caches..."
worked for me.
Closing and Re-Importing project worked for me.
For everyone who comes to this thread and builds with maven: add support-v4 dependency and build to download the repo.
Then add the library manuelly to your project:
Project Structure -> Libraries -> Add
And move to you're repo for the correct jar file: C:\Users\XXXXXXX\.m2\repository\com\google\android\support-v4\r7\support-v4-r7.jar
The symptom of this problem is usually that the build works fine from the command line (which means your build.gradle
file is set up right) but you get syntax highlighting errors in the IDE. Follow This Steps To Solve The Problem: Click on Tools from the toolbar usually at the top part of your IDE, and then navigate to Android then navigate to Sync Project with Gradle Files button. We realize it's less than ideal that the IDE can't just take care of itself instead of forcing you to manually sync at the right time; we're tracking progress on this in https://code.google.com/p/android/issues/detail?id=63151
I'm running the most current version of AndroidStudio to date (11/10/2015) -- v1.4 (build AI-141.2288178, built on September 28, 2015) and I built my project and everything worked fine. Then after a few hours of my computer being inactive I came back, edited some code that had nothing to do with the support libraries and started seeing :
cannot resolve symbol 'fragmentactivity' and I was seeing red highlighted items related to fragmentactivity in the AndroidStudio editor.
The solution was to simply do a
Build...Rebuild Project...
I only mention this so others might see it and know it is happening out there.
For me : Build->Clean Project solved this question