Project Gradle同步保持失败。 (未找到Gradle DSL方法)

时间:2015-10-18 11:41:45

标签: java android gradle sample

初学Android开发人员因此没有很多关于gradle如何工作的经验,我已经尝试过查看其他示例但我仍然无法解决我的问题。基本上,我刚从google android开发人员示例中下载了一个示例项目,并且无法成功构建项目。我一直得到:Gradle sync failed: Gradle DSL method not found: 'compile()'

app gradle是:

apply plugin: 'com.android.application'

android {
    enforceUniquePackageName = false
    compileSdkVersion android_compile_version
    buildToolsVersion android_version


    defaultConfig {
        minSdkVersion android_min_sdk_version
        targetSdkVersion android_compile_version
        versionCode 1
        versionName "1.0"
    }

    lintOptions {
        abortOnError false
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile "com.android.support:appcompat-v7:${appcompat_library_version}"
    compile "com.android.support:support-v4:${support_library_version}"
    compile project(':libraries:BaseGameUtils')
    compile 'com.google.android.gms:play-services:4.3.23'
}

buildscript {
    repositories {
        jcenter()
    }
}

和项目gradle:

// this is the parent build configuration for all the sample projects.
// for more information on gradle build files when used in a multi-project build, see
// http://gradle.org/docs/current/userguide/multi_project_builds.html

buildscript {
    repositories {
        jcenter()
    }

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

// allprojects apply to every project
allprojects {
    repositories {
        jcenter()
    }

    ext {
        android_compile_version = 23
        android_version = '23.0.1'
        android_min_sdk_version = 9

        appcompat_library_version = '23.0.1'
        support_library_version = '23.0.1'
        gms_library_version = '8.1.0'
    }
}

0 个答案:

没有答案