gradle编译问题:
A problem occurred evaluating project ':login'. > Could not find method plugins() for arguments [build_2c31lk3groc7yx58a8uwub95i$_run_closure2@cf3b05b] on project ':login' of type org.gradle.api.Project. org.gradle.api.GradleScriptException: A problem occurred evaluating project ':login'. Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method plugins() for arguments [build_2c31lk3groc7yx58a8uwub95i$_run_closure2@3f8bc2a0] on root project 'ModuleComponentDemo' of type org.gradle.api.Project. at build_2c31lk3groc7yx58a8uwub95i.run(D:\Workspace\Project\Android\StudyStore\kt\ModuleComponentDemo\login\build.gradle:7)
引发问题的gradle文件中代码:
if (isRelease) { plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' } } else { plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' } }
处理方案:
if (isRelease) { apply plugin: 'com.android.library' apply plugin: 'org.jetbrains.kotlin.android' } else { apply plugin: 'com.android.application' apply plugin: 'org.jetbrains.kotlin.android' }
标签:kotlin,gradle,studio,plugins,id,org,GradleScriptException,android From: https://www.cnblogs.com/swalka/p/16967878.html