I am building a small library project along wit a sample project to illustrate the use. I can't manage to run the sample in Android Studio. I have created the project from scratch. I am experienced with Eclipse but it's my first try at Android Studio & Gradle.

The error given:

> 
> Gradle: Execution failed for task ':demo:dexDebug'.
> 
> 
> Running C:\DevTools\Android\android-studio\sdk\build-tools\android-4.2.2\dx.bat
>  failed. See output
> 
> 
> 

I have the following folder structure:

```
- demo
  - build
  - libs
    - android-support-v4.jar
  - src
    - main
      - java
      - res
  - build.gradle
- library
  - build
  - libs
    - android-support-v4.jar
  - src
    - main
      - java
      - res
  - build.gradle
- build.gradle
- settings.gradle

```

Build.gradle at project root:

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

```

Settings.gradle at project root:

```
include ':library', ':demo'

```

Build.gradle for the library module:

```
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }
}
apply plugin: 'android-library'

dependencies {
    compile files('libs/android-support-v4.jar')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16
    }
}

```

Build.gradle for the sample module:

```
buildscript {
    repositories {
        mavenCentral() 
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }
}
apply plugin: 'android'

dependencies {
    compile project(':library')
    compile files('libs/android-support-v4.jar')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16
    }
}

```