【发布时间】:2019-10-26 23:01:08
【问题描述】:
我正在将我的单体应用程序重构为多模块应用程序,但我在使用 Google Play Services gradle 插件时遇到了困难。我使用一些播放服务功能,如地图或谷歌登录,它们需要一些由 GPS gradle 插件方便地生成到 android 资源的 api 密钥或客户端 ID,我可以在我的代码中使用它们。但是,如果我把这条神奇的线放在一边
apply plugin: 'com.google.gms.google-services'
到我的base 模块build.gradle 的底部我得到一个神秘的错误
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':base'.
> java.lang.NullPointerException
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
CONFIGURE FAILED in 0s
Cause: java.lang.NullPointerException
我已经阅读了一些线程,我必须将此插件应用于顶级应用程序模块。但是如何在我的功能/库模块中访问插件提供的这些生成的资源?
【问题讨论】:
-
请看我更新的答案。我不是 100% 确定问题是什么,但很乐意提供帮助。
标签: android gradle module google-play-services