5

我收到此错误:

Gradle: Execution failed for task ':Foo:dexDebug'.

从 2 天开始!我尝试了很多解决方案......但没有任何工作正常!真的 !需要帮忙 !我与安卓工作室一起工作。(智能思想)

对于这以下三个目录

   FooProject [RootProject]
   |-gradle
   |-libraries
     |-facebook [library1]
       |-libs
          |-android-support-v4.jar
       |-res
          |-*.(drawable...)
       |-src
          |-*.java
       |-build.gradle
       |-AnroidManifest.xml
       |-facebook.iml
     |-foosdk [library2]
       |-res
          |-*.(drawable...)
       |-src
          |-*.java
       |-libs
          |-YouTubeAndroidPlayerApi.jar
       |-build.gradle
       |-AnroidManifest.xml
       |-foosdk.iml
   |-Foo [project for execution]
     |-libs
        |-commons-io-1.3.2.jar
        |-commons-lang3-3.1.jar
        |-jackson-core-asl-1.9.11.jar
        |-jackson-databind-2.1.4.jar
        |-jackson-mapper-asl-1.9.11.jar
        |-robospice-1.4.1-SNAPSHOT.jar
        |-robospice-cache-1.4.1-SNAPSHOT.jar
        |-robospice-spring-android-1.4.1-SNAPSHOT.jar
        |-spring-android-core-1.0.1.RELEASE.jar
        |-spring-android-rest-template-1.0.1.RELEASE.jar
        |-YouTubeAndroidPlayerApi.jar
     |-src
      |-main
        |-java
          |-*.java
        |-res
          |-*.(drawable...)
     |-build.gradle
     |-AnroidManifest.xml
     |-Foo.iml
   |-gradlew
   |-gradlew.bat
   |-local.properties
   |-settings.gradle
   |-RootProject.iml

我有我的 settings.gradle

include ':libraries:facebook', :libraries:foosdk', ':foo'

对于文件“build.gradle”:

对于图书馆/facebook/build.gradle

buildscript {
    repositories {
        maven { url 'http://repo1.maven.org/maven2' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}

apply plugin: 'android-library'

dependencies {
    compile 'com.android.support:support-v4:13.0.0'
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 16
    }

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

对于库/foosdk/build.gradle

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

apply plugin: 'android-library'

dependencies {
    compile 'com.android.support:support-v4:13.0.0'
    compile fileTree(dir: 'libs', include: '*.jar')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 16
    }

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

对于 Foo/build.gradle

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

apply plugin: 'android'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.android.support:support-v4:13.0.0'

    compile project(':libraries:foosdk')
    compile project(':libraries:facebook')
    compile fileTree(dir: 'libs', include: '*.jar')
}



android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 16
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src/main/java']
            resources.srcDirs = ['src']
            res.srcDirs = ['src/main/res']
        }
    }
}
4

1 回答 1

0

您的 Foo 项目是在 /Foo 还是 /foo 文件夹中(注意大写)?您可能需要将包含“foo”更正为“Foo”?

如果这不起作用,请粘贴 Gradle 构建的信息或调试输出。如果您正在运行 AndroidStudio 并且没有任何输出,请转到项目的根目录并运行gradlew.bat assembleDebug --info(在 Wins 上)或./gradlew assembleDebug --info(在 Linux/Mac 上)或--debug将输出粘贴到此处,以便我们可以准确地看到哪里出了问题。

于 2013-10-03T13:42:07.113 回答