前言:
在写组件化例子的时候出现的编译不通过报错,报错如下
Build file 'D:\AndroidLearn\NeteaseModular\personal\build.gradle' line: 10 A problem occurred evaluating project ':personal'. > No signature of method: build_2zhwtwxz6h5o6rd8bweetbenw.android() is applicable for argument types: (build_2zhwtwxz6h5o6rd8bweetbenw$_run_closure1) values: [build_2zhwtwxz6h5o6rd8bweetbenw$_run_closure1@60dd4ae8]
因为本项目创建时勾选的是Kotlin语言,因此Android studio会自动加入插件apply plugin: “kotlin-android”
本人再做集成化时,没把该插件加上导致报错
1、错误写法
if (isRelease) { apply plugin: "com.android.library" } else { apply plugin: "com.android.application" apply plugin: "kotlin-android" }
2、正确写法
if (isRelease) { apply plugin: "com.android.library" apply plugin: "kotlin-android" } else { apply plugin: "com.android.application" apply plugin: "kotlin-android" }
这样再次编译项目问题解决!