title: Cannot find symbol class in Android Studio
body: <p>I have two project A and B where B is added as a module of project A. I have added dependencies in A's Gradle build file. Now i can import B's class in A without any error (in editor) but can't build. Preferences is a class of project B.</p>
  
  <h1>Error</h1>
  
  <pre><code>Error:(22, 23) error: cannot find symbol class Preferences 
  </code></pre>
  
  <h1>A's build file</h1>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 21
      buildToolsVersion "21.0.0"
  
      defaultConfig {
          applicationId "com.example.A"
          minSdkVersion 9
          targetSdkVersion 21
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:appcompat-v7:21.0.3'
      compile project(':B')
  }
  </code></pre>
  
  <h1>B's build file</h1>
  
  <pre><code>import org.apache.tools.ant.taskdefs.condition.Os
  
  apply plugin: "android-library"
  
  android {
      compileSdkVersion 18
      buildToolsVersion "21.0.0"
  
      defaultConfig {
          minSdkVersion 9
          targetSdkVersion 11
      }
  
      buildTypes {
          release {
              minifyEnabled true
              proguardFiles 'proguard.cfg'
          }
      }
      sourceSets.main {
          jniLibs.srcDir 'src/main/jniLibs'
          jni.srcDirs = [] //disable automatic ndk-build call
      }
  
      task ndkBuild(type: Exec) {
          if (Os.isFamily(Os.FAMILY_WINDOWS)) {
              commandLine 'ndk-build.cmd', '-C', file('src/main/jni').absolutePath
          } else {
              commandLine '/opt/adt-bundle-linux/android-ndk-r8e/ndk-build', '-C', file('src/main/jni').absolutePath
          }
          tasks.withType(JavaCompile) {
              compileTask -&gt; compileTask.dependsOn ndkBuild
          }
      }
  
  }
  
  dependencies {
      compile 'com.android.support:support-v4:18.0.0'
  }
  </code></pre>
  
  <p>I can successfully build the project(A) if remove the import.</p>