classpath、compileOnly、implementation、api、apply plugin

compileOnly: 源码依赖,不打包进apk
implementation: 隐藏依赖,依赖该模块的模块无法调用此库
api: 不隐藏依赖,可跨模块依赖传递
classpath: 声明插件一般是添加 buildscript 本身需要运行的东西,不会编译到apk中,将插件添加到构建脚本的 classpath 中,我们的 Gradle 构建脚本才能应用插件
apply plugin:应用插件注入,在需要使用插件的 .gradle 脚本中使用 apply 应用插件,这将创建一个新的 Plugin 实例,并执行 Plugin#apply()

参考

https://www.jianshu.com/p/af1c23b1eedc
https://zhuanlan.zhihu.com/p/110215979
https://www.learnfk.com/articles/M325518.html

猜你喜欢

转载自blog.csdn.net/b1tb1t/article/details/128793876