Build.Gradle Error(22,0)无法找到方法chandroid()

时间:2017-05-15 03:06:03

标签: java android android-studio gradle

我是Android Studio新手,我已经完成了我的简单应用。但问题是,在将app文件夹从我的桌面复制到笔记本电脑后尝试打开项目时,我有Gradle问题。 (包括用于更好地理解问题的屏幕截图链接)

main Build.Gradle http://puu.sh/vQl8c/bcade1a2e2.png

// 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.3.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

//不需要 // chandroid { // compileSdkVersion 19 //}

app Build.Grade http://puu.sh/vQl9v/e7363ddb74.png

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.afinal.eaglearms.learnk"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        externalNativeBuild {
            cmake {
                cppFlags ""
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:design:25.3.1'
}

1 个答案:

答案 0 :(得分:1)

chandroid {
   compileSdkVersion 19
}

从主/根build.gradle文件中删除它。它应该是android而不是chandroid,这也不是必需的,因为你已经在app模块的build.gradle中定义了。