错误:(72,0)在Android 1.4中找不到Gradle DSL方法

时间:2015-10-09 07:53:45

标签: android android-gradle build.gradle

Android 1.4

错误:(72,0)找不到Gradle DSL方法:' android()' 可能的原因:项目'我的项目'可能正在使用不包含该方法的Gradle版本。

href =" openGradleSettings Gradle设置构建文件可能缺少Gradle插件。

href apply.gradle.plugin 应用Gradle插件

这是我的Project Build.Gradle

    buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
    }
}
allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = '1.0'
    ext {
        appName = 'Paddle'
        gdxVersion = '1.5.3'
        roboVMVersion = '1.0.0-beta-03'
        box2DLightsVersion = '1.3'
        ashleyVersion = '1.3.1'
        aiVersion = '1.5.0'
    }

    repositories {
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    }
}
project(":desktop") {
    apply plugin: "java"
dependencies {
    compile project(":core")
    compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
    compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
}
}
project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        compile project(":BaseGameUtils")
        compile fileTree(dir: '../libs', include: '*.jar')
    }
}
project(":core") {
    apply plugin: "java"


    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        compile fileTree(dir: '../libs', include: '*.jar')
    }
}
tasks.eclipse.doLast {
    delete ".project"
}
android {
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 19
    }
    productFlavors {
    }
    compileSdkVersion 21
    buildToolsVersion '23.0.1'
}
dependencies {
    compile files('libs/pushbots.2.0.8.jar')
    compile files('libs/tween-engine-api.jar')
    compile files('libs/tween-engine-api-sources.jar')
}

1 个答案:

答案 0 :(得分:0)

android DSL来自jcenter()而不是mavenCentral()

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