簡體   English   中英

defaultConfig,buildTypes,packagingOptions和dependencies不能應用於(groovy.lang.Closure)

[英]defaultConfig, buildTypes, packagingOptions and dependencies cannot be applied to (groovy.lang.Closure)

我知道這個問題之前已經回答了,但是他們沒有為我工作。 該應用程序編譯和運行完美但這個警告很煩人。 移動gradle中的基本defaultConfig,buildTypes,packagingOptions和依賴項,以及頂級gradle中的依賴項都使得無法應用於(groovy.lang.Closure)警告:

頂級gradle:

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'
}

我有同樣的問題,更新到gradle 1.3.1為我工作。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM