title: How to make Android Studio read (minSdkVersion from) AndroidManifest.xml correctly?
body: <p>I have an Android project which was created in Eclipse, <a href="http://developer.android.com/sdk/installing/migrate.html" rel="noreferrer">exported as Gradle build file</a>, then opened in Android Studio. (Yes, it would be far easier to create a clean project in AS but I need to support the current project structure.)</p>
  
  <p>Otherwise things are now mostly working, but there's still some stuff to be ironed out. 
  In every Activity class, AS shows this error: <code>Class requires API level 1 (current min is -1): Activity</code></p>
  
  <p><img src="https://i.stack.imgur.com/03sRF.png" alt="enter image description here"></p>
  
  <p>Alt+Enter offers to fix that with a <code>@TargetApi</code> annotation... but why should I have to do that, when in <code>AndroidManifest.xml</code>, we have:</p>
  
  <pre><code>&lt;uses-sdk
      android:minSdkVersion="14"
      android:targetSdkVersion="18" /&gt;
  </code></pre>
  
  <p><code>AndroidManifest.xml</code> is located at project root (Eclipse default?). Looks like Android Studio is not correctly reading the settings in it. The project still compiles fine though. </p>
  
  <p>Any idea how to get rid of the error? </p>
  
  <p>The Eclipse-generated <code>build.gradle</code> looks like this:</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.5.+'
      }
  }
  apply plugin: 'android'
  
  dependencies {
      compile fileTree(dir: 'libs', include: '*.jar')    
  }
  
  android {
      compileSdkVersion 18
      buildToolsVersion "18.1.0"
  
      sourceSets {
          main {
              manifest.srcFile 'AndroidManifest.xml'
              java.srcDirs = ['src']
              resources.srcDirs = ['src']
              aidl.srcDirs = ['src']
              renderscript.srcDirs = ['src']
              res.srcDirs = ['res']
              assets.srcDirs = ['assets']
          }
  
          // Move the tests to tests/java, tests/res, etc...
          instrumentTest.setRoot('tests')
  
          // Move the build types to build-types/&lt;type&gt;
          // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
          // This moves them out of them default location under src/&lt;type&gt;/... which would
          // conflict with src/ being used by the main source set.
          // Adding new build types or product flavors should be accompanied
          // by a similar customization.
          debug.setRoot('build-types/debug')
          release.setRoot('build-types/release')
      }
  }
  </code></pre>