错误:(10,0)没有找到gradle方法classpath()

时间:2015-04-28 19:23:45

标签: android facebook gradle android-gradle build.gradle

你好,我是Android工作室的新手,我导入了facebook,首先我收到了这个错误Error:(111) Cannot call getBootClasspath() before setTargetInfo() is called.,我按照了正确的答案here。即我改变了我的依赖

dependencies {
    compile 'com.android.support:support-v4:[21,22)'
    compile 'com.parse.bolts:bolts-android:1.1.4'
}

 dependencies {
        classpath 'com.android.tools.build:gradle:1.1.3'
    }

现在我收到此错误

   Error:(10, 0) Gradle DSL method not found: 'classpath()'
Possible causes:The project 'FiberTeccpcp' may be using a version of Gradle that does not contain the method.
        Gradle settings
The build file may be missing a Gradle plugin.
        Apply Gradle plugin

最后这是我的build.gradle文件

apply plugin: 'com.android.library'

repositories {
  mavenCentral()
}

project.group = 'com.facebook.android'

dependencies {
    classpath 'com.android.tools.build:gradle:1.1.3'
}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 21
    }

    lintOptions {
        abortOnError false
    }

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

apply plugin: 'maven'
apply plugin: 'signing'
......

我该如何纠正?

1 个答案:

答案 0 :(得分:1)

您必须将此部分包含在buildscript

dependencies {
    classpath 'com.android.tools.build:gradle:1.1.3'
}

应该是:

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
       classpath 'com.android.tools.build:gradle:1.1.3'
    }
}