darklord
darklord

Reputation: 5167

Incompatible Android Studio source structure and gradle error

The Android Studio version I am using is 0.5.3. I created a project with the IDE. The default file structure is:

-root
    -build.gradle
    -app/
        -build.gradle
        -libs/
        -src/
        -build/
    -gradle/

I changed the root build.gradle file a little bit. That is, I added an android{} element to it:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
    }
}

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
    }

}

allprojects {
    repositories {
        mavenCentral()
    }
}

However I received the following error:

/Users/jackiee/AndroidStudioProjects/RoboTest/src/main/AndroidManifest.xml (No such file or directory)

I am confused. The auto created project places all source files under app/, why the directory gradle is looking for is missing app?

Upvotes: 0

Views: 364

Answers (1)

Scott Barta
Scott Barta

Reputation: 80010

The modifications you made to your root build.gradle file are the problem. If it sees apply plugin: 'android in a build file, it expects to see an Android module in that directory, but projects generally aren't structured such that there's an Android module at the root. The specific error message you're seeing is that it's looking for the manifest file for this nonexistent Android module and it's not seeing it.

Remove the apply plugin statement and the android block from the root-level build file.

Upvotes: 2

Related Questions