java - Build.Gradle Error (22,0) 找不到方法 chandroid()

标签 java android android-studio gradle

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

主 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
}

//不需要 //机器人 { //compileSdkVersion 19 //

应用构建.等级 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'
}

最佳答案

chandroid {
   compileSdkVersion 19
}

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

关于java - Build.Gradle Error (22,0) 找不到方法 chandroid(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43971035/

相关文章:

java - 如何在java中的webdriver中使用多个断言

java - Glassfish 4.1 LogFactory 和 WSSElementFactory NoClassDefFoundError

java - 在匿名 ActionListener 中调用抛出异常的方法,而不使用 try/catch

android - 在 Android Studio 中将现有项目从 Eclipse 转换为 Gradle

java - 从 Android 的下载文件夹中获取 pdf 或 doc 文件

java - R无法解析为eclipse中的变量

android - 如何在 Android 的 Retrofit 中获取 header 响应?

android - 监听 Internet 变化(无网络检测)

Android:将组件添加到 RelativeLayout

unit-testing - 测试覆盖率 - 排除 Android SDK