Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot invoke method containsKey() on null object

I got this error when I was building my Android project by gradle. It roughly happened once per week.

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

Any idea what may cause this error? thanks

like image 853
Cody Avatar asked Sep 14 '18 06:09

Cody


2 Answers

From @tapchicoma comment to the original question, the issue: NullPointerException in Google Services Plugin now is marked as fixed for 4.2.0.

So, the final solution is to update to:

classpath 'com.google.gms:google-services:4.2.0'
like image 51
Xavier Rubio Jansana Avatar answered Nov 11 '22 07:11

Xavier Rubio Jansana


Until the bug is fixed by google, downgrading to the play services 4.0.1 seems to have fixed this issue for me so far:

classpath 'com.google.gms:google-services:4.0.1'

https://stackoverflow.com/a/50930048/4096987

like image 2
AndroidEx Avatar answered Nov 11 '22 06:11

AndroidEx