找不到Gradle DSL方法:'compile()'错误

时间:2015-06-20 17:44:39

标签: java android android-studio

我保证已经查看了所提供的所有答案。

1) I wanted to use DialogFragment and developers guide suggested to install Support libraries.  I agree I did not go through and pick and choose and I asked it to install all 22 Android support libraries (Android support repository already looked installed).

2) Ensured that the project level build.gradle does not have any compile under dependencies.  Only the Module: app level build.gradle has the compile.

3) When I attempted to add the compile "com.android.support:support-v4:18.0.+" to the app module build.gradle, it reds on me because the target sdk is 22.  So, I go to change it to 18.  No dice.

4) Same annoying error: Gradle DSL method not found: compile():The project may be using a version that does not contain the method: open Gradle wrapper.properties OR The build file may be missing a plugin : Apply Gradle plugin

5) I applied every possible plugin.

非常感谢任何帮助。

项目级build.gradle:

//顶级构建文件,您可以在其中添加所有子项目/模块共有的配置选项。

    buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

App level build.gradle:

 apply plugin: 'com.android.application'

    android {
    signingConfigs {
        config {
            keyAlias '******'
            keyPassword '*******'
            storeFile file('********************')
            storePassword '********'
        }
    }
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        applicationId "project.sample.com.blatest"
        minSdkVersion 8
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'


<!-- begin snippet: js hide: false -->

<!-- language: lang-html -->

    apply plugin: 'com.android.application'

    android {
        signingConfigs {
            config {
                keyAlias 'dialogkey'
                keyPassword 'changeme'
                storeFile file('C:/Users/ybxk021/.android/default.keyset')
                storePassword 'blabla123'
            }
        }
        compileSdkVersion 22
        buildToolsVersion "22.0.1"
        defaultConfig {
            applicationId "project.sample.com.dialogtest"
            minSdkVersion 8
            targetSdkVersion 22
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'),        'proguard-rules.pro'
            }
        }
    }
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:support-v4:22.2.0'


}




}

0 个答案:

没有答案