解决Android Studio Gradle DSL method not found: 'android()'问题

来源:互联网 发布:公司域名是什么样的 编辑:程序博客网 时间:2024/06/05 02:56
今天碰到一个朋友配置AndroidStudio项目中遇到了Android Studio Gradle DSL method not found: ‘android()’的问题


这里写图片描述


解决方案如下:


去掉项目中最外层的build.gradle的


android {
    compileSdkVersion 19
    buildToolsVersion 23.0.2
}
1
2
3
4
1
2
3
4
并按照如下规范配置你的AndroidStudio中的Gradle


build.gradle:


buildscript {
    repositories {
        mavenCentral()
    }


    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0'
    }
}


allprojects {
    repositories {
        mavenCentral()
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
app/build.gradle:


apply plugin: 'com.android.application'


android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'


    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 1
        versionName '1.0'
    }
}
宁波整形美容http://www.biopls.net/Project/list-6-1.shtml

dependencies {
    compile 'com.android.support:appcompat-v7:23.2.1'
}
Then run gradle:
gradle installDebug
阅读全文
0 0
原创粉丝点击