Android studio 找不到方法buildTypes()

Android studio 找不到方法buildTypes(),android-studio,gradle,android-gradle-plugin,Android Studio,Gradle,Android Gradle Plugin,我面临着这个问题 找不到参数[build_3R52 Yusive35ZN4CVWCE7KC4Y$\u run_closure1]的方法buildTypes()$_closure3@16d58fc]在org.gradle.api.project类型的根项目“testapp”上。 打开文件 找不到方法buildTypes() 这是因为您在build.gradle中错误地放置了buildTypes。它必须位于模块build.gradle中的android块中。大概是这样的: apply plugin:

我面临着这个问题

找不到参数[build_3R52 Yusive35ZN4CVWCE7KC4Y$\u run_closure1]的方法buildTypes()$_closure3@16d58fc]在org.gradle.api.project类型的根项目“testapp”上。 打开文件

找不到方法buildTypes()

这是因为您在
build.gradle
中错误地放置了
buildTypes
。它必须位于
模块
build.gradle
中的
android
块中。大概是这样的:

apply plugin: 'com.android.application'

android {
  compileSdkVersion 28
  buildToolsVersion "29.0.0"

  defaultConfig {
    // your app config
    ...
  }

  // your buildTypes here. It's must be inside the android block
  buildTypes {
    ...
  }

}

dependencies {
  // your dependencies.
  ...
}
您需要查阅文档以了解详细信息


您当前的
build.gradle
图片看起来像您项目的
build.gradle
。有关详细信息,请访问。

您的文章中未正确包含降价图片。你的头衔也太长了。请,也直接将您的代码添加到您的帖子。。。不是截图。我把buildtypes{}放在了android块中。你还面临这个问题吗?如果是,请共享项目根目录/build.gradle和app/build.gradle。