defaultConfig,buildTypes,packagingOptions和dependencies不能应用于(groovy.lang.Closure)

时间:2015-08-12 14:20:45

标签: android android-gradle

我知道这个问题之前已经回答了,但是他们没有为我工作。该应用程序编译和运行完美但这个警告很烦人。移动等级中的基本defaultConfig,buildTypes,packagingOptions和依赖关系,以及顶级等级中的依赖关系都使得无法应用于(groovy.lang.Closure)警告:

顶级等级:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.google.gms:google-services:1.3.0-beta1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

移动等级:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "net.udazz.udazz"
        minSdkVersion 11
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'LICENSE.txt'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-gcm:7.5.+'

    compile 'com.android.support:appcompat-v7:22.2.1'

    // Testing dependencies
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'
    androidTestCompile 'com.android.support.test:runner:0.2'
    androidTestCompile 'com.android.support:support-annotations:22.2.1'
}

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,更新为gradle 1.3.1为我工作。

classpath 'com.android.tools.build:gradle:1.3.1'