2016-06-11 102 views
0

我在Android Studio打開好友項目,我的AS版本比他大。

以下是錯誤:找不到Gradle的DSL方法android()

Error:(27, 0) Gradle DSL method not found: 'android()' 
Possible causes:The project 'firstapp' may be using a version of Gradle that does not contain the method. 
Open Gradle wrapper file  The build file may be missing a Gradle plugin. 
Apply 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:2.2.0-alpha1' 
     classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 
allprojects { 
    repositories { 
     jcenter() 
     mavenCentral() 
     maven { 
      url 'https://oss.sonatype.org/content/repositories/snapshots/' 
     } 
    } 
} 
task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

android { 
    compileSdkVersion 19 
    buildToolsVersion '21.0.0' 
} 
dependencies { 
} 

我怎樣才能得到這個固定的?

回答

2

從官方文檔查看。 https://developer.android.com/studio/build/index.html

/** 
 * The first line in the build configuration applies the Android plugin for 
 * Gradle to this build and makes the android {} block available to specify 
 * Android-specific build options. 
 */ 

apply plugin: 'com.android.application' 
+0

現在我得到另一個錯誤:錯誤:(2,0)原因:COM /安卓/建設/ gradle產出/ AppPlugin:不支持MAJOR.MINOR版本使用Java 52.0 Open File

+0

7,而不是8個 – mrkernelpanic

+0

謝謝,該項目使用JDK 1.7,我更新了1.8 –

相關問題