Cannot invoke method containsKey() on null object
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
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'