2017-02-20 97 views
0

你好,大家好,我打算上运行的构建工具版本24.0.1的项目,但gradles继续显示此错误。有没有人遇到过这个错误?

消息摇篮同步:

Error:(19, 0) Could not find method android() for arguments [[email protected]] on root project 'CardDemo-master' of type org.gradle.api.Project. 
<a href="openFile:D:\New folder\CardDemo-master\build.gradle">Open File</a> 

的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.3' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 
allprojects { 
    repositories { 
     jcenter() 
    } 
} 

android { 
    buildToolsVersion '24.0.1' 
} 
dependencies { 
} 

应用程序/的build.gradle

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "24.0.0 rc3" 

    defaultConfig { 
     applicationId "com.delaroystudios.carddemo" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.1.1' 
    compile 'com.android.support:design:23.1.1' 
    compile 'com.android.support:recyclerview-v7:23.1.1' 
    compile 'com.android.support:cardview-v7:23.1.1' 
} 

回答

0

在顶级gradle这个文件中删除android块,而是改变在应用文件的gradle的buildToolsVersion值。

+0

感谢您的帮助。对此,我真的非常感激 – ShunJian

0

解决:

的build.gradle(项目)

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.3' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 
allprojects { 
    repositories { 
     jcenter() 
    } 
}