KJaeg
KJaeg

Reputation: 686

Android Studio Gradle Build error - specified for property 'manifest' does not exist

I think I have a minor problem with my Gradle build files in Android Studio. Since I have no experience with them, and the few research results didn't resolve my problem, I think, that some of you guys maybe know how to resolve that issue.

At first I want to explain how I "constructed" my project in case you need this information. At first I created a fresh Android Studio project to get the project/directory structure. When the creation was finished, I closed Android Studio and checked them manually out of our SVN. The reason is not really important for my issue, but I did it to leave the project structure of my company the way it is(the Android part is just a small part of it). Instead I checked my Android Studio project in and linked all necessary files with SVN externals. So it is able to checkout and commit without changing anything in the project structure. Anyways, by creating a new project my Gradle files have been the default ones, after creating a new project. Since all necessary files have been checked out in the correct Android Studio project directories, I started Android Studio again, deleted the previously created project from the list, and imported it again. After that all my new files have been displayed. Even the new libraries are included in my Gradle build file under dependencies, as you will see.

But when I am trying to Build my project (I tried "Rebuild" and "Make project") I receive following Gradle error message:

FAILURE: Build failed with an exception.

What went wrong: A problem was found with the configuration of task ':app:checkDebugManifest'. File 'D:\Workspace\MyProject\app\src\main\AndroidManifest.xml' specified for property 'manifest' does not exist.

This is my build.gradle in my projects root directory:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

and this is the build.gradle in my "app"-directory

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "22.0.0"

    defaultConfig {
        applicationId "de.abc.def.xyz"
        minSdkVersion 15
        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:22.0.0'
}

If you guys need more information (settings.gradle, .properties-files, AndroidManifest.xml) just tell me.

I don't know if this is important but, this is what the Gradle Console shows, before the error occurs:

Configuration on demand is an incubating feature. 
:app:preBuild UP-TO-DATE 
:app:preDebugBuild UP-TO-DATE 
:app:checkDebugManifest FAILED

Upvotes: 3

Views: 12846

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363439

Gradle is looking for the manifest at \src\main\AndroidManifest.xml, which is the default for new Gradle projects.

If you are using a different folder, you can specify a different location in your build.gradle using something like this:

android {
    // ...

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

}

Upvotes: 6

Related Questions