If you use different version of play services libraries, you will get this error.
For example, below entries in build.gradle file cause the error as versions are different.
implementation 'com.google.android.gms:play-services-maps:11.4.2'
implementation 'com.google.android.gms:play-services-location:11.6.0'
To fix the issue use same versions.
implementation 'com.google.android.gms:play-services-maps:11.6.0'
implementation 'com.google.android.gms:play-services-location:11.6.0'