Android Studio Marks syntax as error, but gradle compiles

android, android-studio, gradle

Solution

These are not errors actually, this a bug in Android studio( 0.4.2 ) for resolving the symbol and fixed for the next release( 0.4.3 ).

To get Rid of these until the release do the following

- Clean your project using `Build > Clean Project`

- Close your Android Studio

- Take Backup of your project

- Delete all .iml files inside your project

- Delete content of .idea directory

- Open Studio and wait until it completes the sync with gradle

Also verify if you are seeing any error in `File > Project Structure` . If there is any error saying "Dependency Not Added "click on that and using red bulb on right side Add them to dependency.

UPDATE

Android Studio 0.4.3 is available on Canary Channel Now.

Problem

I have a project in Android Studio which compiles with Gradle. The general file structure is ``` MyProject - MyProjectSource - Libraries - ActionBarSherlock ``` My project is built with Gradle and will compile without issue. However in the lines within my activity where I include a component from ActionBarSherlock, Android Studio marks it as an error. I have noticed that Android Studio has also generated .iml files. So my question: Does Android Studio ignore the gradle build when assessing whether something is valid syntax or not? Obviously this is not a project blocking problem but it does slow velocity not being able to take advantage of the full set of tools Android Studio has to offer. Thanks in advance for any help.

Original source