2015-01-12 129 views
1

我使用IDE android studio 1.0.2版本。未找到Gradle DSL方法:compile()

我收到以下錯誤

Gradle DSL method not found: 'compile()' 
Error(0,9): The project 'MiarrayAdapter' may be using a version 
of Gradle that does not contain the method 
the built file may be missing a Gradle plugin 

我的文件build.gradle是:

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

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

從來就其他文件的build.gradle(模塊的應用程序),代碼爲:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.2" 

    defaultConfig { 
     applicationId "com.cursoandroid.miarrayadapter" 
     minSdkVersion 6 
     targetSdkVersion 21 
     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:+' 
} 


    allprojects { 
     repositories { 
      jcenter() 
     } 
    } 

回答

1

從您的頂級build.gradle如下:

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

同時注意評論有:

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