Android 无法对null对象调用containsKey()方法
我在gradle构建Android项目时犯了这个错误。这大概每周发生一次Android 无法对null对象调用containsKey()方法,android,android-gradle-plugin,google-play-services,Android,Android Gradle Plugin,Google Play Services,我在gradle构建Android项目时犯了这个错误。这大概每周发生一次 FAILURE: Build failed with an exception. * What went wrong: Failed to capture snapshot of input files for task ':xxxxxxxx:compileDebugAidl' property 'importDirs' during up-to-date check. > Cannot invoke method
FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture snapshot of input files for task ':xxxxxxxx:compileDebugAidl' property 'importDirs' during up-to-date check.
> Cannot invoke method containsKey() on null object
* 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
知道是什么导致了这个错误吗?感谢在谷歌修复该漏洞之前,降级到play services 4.0.1似乎已经为我解决了这个问题:
classpath'com.google.gms:googleservices:4.0.1'
从@tapchicoma comment到原始问题,问题:now被标记为
4.2.0
的固定问题
因此,最终的解决方案是更新到:
classpath 'com.google.gms:google-services:4.2.0'
你能试试吗?
Try:Run with--stacktrace选项获取堆栈跟踪
你的gradle插件版本是什么?或者更好:--scan
在gradle.properties的某个地方我正在使用classpath'com.android.tools.build:gradle:3.1.4'我无法正确复制它。这只是随机发生的google Tracker中的相关问题该问题与@tapchicoma指出的issuetracker.google.com/issues/114705291相关。建议的解决办法是降级到3.x.x.@alexfdz这只是一种意见。正如我提到的,我们在团队中亲身经历过这个问题,降级到4.0.1就足以解决我们的问题。