title: Manifest mergeing - Android studio 0.8.1 upgrade build error: property 'manifestFile' does not exist
body: <p>I have just upgraded to Android Studio 0.8.1 and upgraded build tools ect. from Android Studio 0.6</p>
  
  <p>But then I get this build error:</p>
  
  <blockquote>
    <p>A problem was found with the configuration of task
    ':processDevelopmentDebugResources'.</p>
    
    <p>File 'C:\ProjectFolder\build\manifests\DevelopmentDebug\Development\debug\AndroidManifest.xml'
     specified for property 'manifestFile' does not exist.</p>
  </blockquote>
  
  <p>But I can't figure out what the problem is. The folder manifests under build does not exists.<br/>
  I suspect it has something to do with the last part of my code that replaces values in the manifest file. There is something about "Fixes in the manifest mergers" changed in build tools changelist, but I don't know if that is related. But then again - the folder does not exists and this code should change some files in it.</p>
  
  <p>Any clue?</p>
  
  <p><strong>Edit 1:</strong> 
  I just tried to comment the "variant.processManifest.doLast" part out and it works, so the issue is with this code. (Why haven't I tried that before..)<br/>
  <strong>But what has changed in the last version that make this code fail?</strong> It worked before the upgrade.</p>
  
  <p><strong>Edit 2:</strong> 
  See comments under <em>ianhanniballake</em>'s answer.</p>
  
  <p>This is my build.gradle file:</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
          maven { url 'http://download.crashlytics.com/maven' }
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.12.+'
          classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
          classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'
      }
  }
  
  repositories {
      mavenCentral()
      maven { url 'http://download.crashlytics.com/maven' }
  }
  
  apply plugin: 'com.android.application'
  apply plugin: 'crashlytics'
  apply plugin: 'android-apt'
  
  dependencies {
      compile 'com.crashlytics.android:crashlytics:1.+'
      compile fileTree(dir: 'libs', include: '*.jar')
  
      apt "org.androidannotations:androidannotations:3.0.1"
      compile "org.androidannotations:androidannotations-api:3.0.1"
  }
  
  apt {
      arguments {
          resourcePackageName "dk.packagename"
          androidManifestFile variant.processResources.manifestFile
      }
  }
  
  android {
      packagingOptions { //Fix: http://stackoverflow.com/a/20675331/860488
          exclude 'META-INF/DEPENDENCIES'
          exclude 'META-INF/LICENSE'
          exclude 'META-INF/NOTICE'
      }
  
      compileSdkVersion 10
      buildToolsVersion "20.0"
  
      defaultConfig {
          minSdkVersion 8
          targetSdkVersion 10
          buildConfigField "int", "appId", "2"
      }
  
      lintOptions {
          checkReleaseBuilds false
      }
  
      signingConfigs {
          //Use terminal command: gradle assembleKonnektRelease
          releaseKonnekt {
  
          }
      }
  
      productFlavors{
          def konnektSigningConfig = signingConfigs.releaseKonnekt
  
          Development {
              applicationId "dk.packagename"
              versionCode 1
              versionName "1.0.0"
              buildConfigField "int", "appId", "2"
          }
      }
  
      buildTypes {
          testflight.initWith(buildTypes.debug)
          debug {
              applicationIdSuffix ".debug"
          }
  
          testflight {
              applicationIdSuffix ".test"
          }
  
          release {
          }
      }
  
      // Override Data in Manifest
      android.applicationVariants.all { variant -&gt;
          variant.processManifest.doLast {
              copy {
                  // *** SET COPY PATHS ***
                  try {
                      from("${buildDir}/manifests") {
                          //println "from: ${buildDir}/manifests"
                          include "${variant.dirName}/AndroidManifest.xml"
                          //println "included: ${variant.dirName}/AndroidManifest.xml"
                      }
                  } catch (e) {
                      println "error: " + e
                  }
  
                  into("${buildDir}/manifests/${variant.name}")
  
                  def variantName = variant.name.toString()
                  def appName = "empty"
                  def facebookId = "empty"
  
                  // *** SET APP NAME ***
                  if (variantName.contains("Development")) {
                      appName = "Development"
                  } else if (variantName.contains("Konnekt")) {
                      appName = "Konnekt"
                      facebookId = "**"
                  } 
  
                  if(variantName.contains("Debug")){
                      appName = appName + " debug"
                  } else if(variantName.contains("Test")){
                      appName = appName + " test"
                  }
  
                  // *** REPLACE LINES IN MANIFEST ***
                  filter {
                      String line -&gt; line.replaceAll("&lt;application android:allowBackup=\"true\" android:icon=\"@drawable/ic_launcher\" android:label=\"todo\" android:name=\"dk.packagename.App\"&gt;", // implicit "." is replaced with: "dk.packagename."
                                                      "&lt;application android:allowBackup=\"true\" android:icon=\"@drawable/ic_launcher\" android:label=\"" + appName + "\" android:name=\"dk.packagename.App\"&gt;");
                  }
                  filter {
                      String line -&gt; line.replaceAll("&lt;activity android:label=\"todo\" android:name=\"dk.packagename.SplashActivity\"&gt;",
                                                      "&lt;activity android:label=\"" + appName + "\" android:name=\"dk.packagename.SplashActivity\"&gt;");
                  }
                  filter{
                      String line -&gt; line.replaceAll("&lt;meta-data android:name=\"com.facebook.sdk.ApplicationId\" android:value=\"\"/&gt;",
                                                      "&lt;meta-data android:name=\"com.facebook.sdk.ApplicationId\" android:value=\"" + facebookId + "\"/&gt;")
                  }
              }
          }
  
          // *** SET PATH TO NEW MANIFEST ***
          variant.processResources.manifestFile = file("${buildDir}/manifests/${variant.name}/${variant.dirName}/AndroidManifest.xml")
          //println "newManifest: ${buildDir}/manifests/${variant.name}/${variant.dirName}/AndroidManifest.xml"
      }
  }
  </code></pre>