无法在类型为org.gradle.api.Project的根项目'..'上找到参数[build ..]的方法android()

时间:2018-05-30 06:49:26

标签: android gradle android-gradle build.gradle gradle-plugin

当我尝试工作时,以下显示:

  

无法在类型为org.gradle.api.Project的根项目'dangerous-forest-game-android'中找到参数[build_9cxkoz5xxe5p8ydg2a1ig2k7b $ _run_closure1 @ 7b0f017]的方法android()。

我一直在寻找解决问题的方法,但我发现我的语法太不同了。以下是我的Process.Start(@"C:\Program Files\Autodesk\AutoCAD 2018\acad.exe", "/product \"C3D\"" + " " + @"C:\folder\1.dwg" + " " + @"C:\folder\2.dwg" + " " + @"C:\folder\3.dwg" ); 函数的代码:

android()

1 个答案:

答案 0 :(得分:0)

您必须仅在android文件中使用app/build.gradle DSL,在root/build.gradle文件中使用

此外,在使用之前必须在app/build.gradle文件中应用android插件。查看official doc

/**
 * The first line in the build configuration applies the Android plugin for
 * Gradle to this build and makes the android block available to specify
 * Android-specific build options.
 */

apply plugin: 'com.android.application'

/**
 * The android block is where you configure all your Android-specific
 * build options.
 */

android {
  //.....
}
相关问题