I have just upgraded to Android Studio 0.8.1 and upgraded build tools ect. from Android Studio 0.6
But then I get this build error:
A problem was found with the configuration of task ':processDevelopmentDebugResources'.
File 'C:\ProjectFolder\build\manifests\DevelopmentDebug\Development\debug\AndroidManifest.xml' specified for property 'manifestFile' does not exist.
But I can't figure out what the problem is. The folder manifests under build does not exists.
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.
Any clue?
Edit 1:
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..)
But what has changed in the last version that make this code fail? It worked before the upgrade.
Edit 2: See comments under ianhanniballake's answer.
This is my build.gradle file:
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 ->
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 -> line.replaceAll("<application android:allowBackup=\"true\" android:icon=\"@drawable/ic_launcher\" android:label=\"todo\" android:name=\"dk.packagename.App\">", // implicit "." is replaced with: "dk.packagename."
"<application android:allowBackup=\"true\" android:icon=\"@drawable/ic_launcher\" android:label=\"" + appName + "\" android:name=\"dk.packagename.App\">");
}
filter {
String line -> line.replaceAll("<activity android:label=\"todo\" android:name=\"dk.packagename.SplashActivity\">",
"<activity android:label=\"" + appName + "\" android:name=\"dk.packagename.SplashActivity\">");
}
filter{
String line -> line.replaceAll("<meta-data android:name=\"com.facebook.sdk.ApplicationId\" android:value=\"\"/>",
"<meta-data android:name=\"com.facebook.sdk.ApplicationId\" android:value=\"" + facebookId + "\"/>")
}
}
}
// *** 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"
}
}