title: Android Studio marks R in red with error message "cannot resolve symbol R", but build succeeds
body: <p>In every project I've tried to create in Android Studio, all usages of R are marked in red with the error message "cannot resolve symbol R", but the compilation succeeds and the application runs. This is really annoying, as it blocks auto-completion and shows huge red waved lines all over my code.</p>
  
  <p>I'm running Android Studio 1.7.0 and creating the project with default settings. A screenshot is attached:</p>
  
  <p><img src="https://i.stack.imgur.com/YfaJB.png" alt="Android Studio Screenshot"></p>
  
  <p>This is my <code>build.gradle</code>:</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.4'
      }
  }
  apply plugin: 'android'
  
  dependencies {
      compile files('libs/android-support-v4.jar')
  }
  
  android {
      compileSdkVersion 17
      buildToolsVersion "17.0.0"
  
      defaultConfig {
          minSdkVersion 7
          targetSdkVersion 16
      }
  }
  </code></pre>
  
  <p>This is how the Project Structure looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/p7Wg3.png" alt="enter image description here"></p>
  
  <p>Any idea how to fix this?</p>