Since May 23, 2018 update, when you're using a firebase dependency, you must include the firebase-core
dependency, too.
If adding it, you still having the error, try to update the gradle plugin in your gradle-wrapper.properties
to 4.5 version:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip
and resync the project.