无法在根项目上找到方法android()for arguments ....

时间:2017-08-22 13:26:06

标签: android gradle android-gradle

我一直在尝试将一个项目导入到Android Studio中,这就是我遇到的问题,Stack Overflow上有一个类似的问题,但它并没有提供我特定错误的解决方案......

这是我的错误日志:

// 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.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}


android {
    compileSdkVersion 25
    buildToolsVersion '25.0.0'
}
dependencies {
}

这是我的文件Gradle:

p:selectOneMenu

如果你能帮助我,谢谢你< 3

2 个答案:

答案 0 :(得分:0)

将其从项目build.gradle文件移至模块build.gradle文件(例如app/build.gradle):

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.0'
}
dependencies {
}

答案 1 :(得分:0)

android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
}
dependencies {
}

这些属于build.gradle(模块:app)级别