First you need to register your application details like name and package name on firebase console, after creating you can download google-services.json file, keep the file inside your app folder.
add below libraries on app build.gradle file
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-ml-vision:16.0.0'
Go to Tools -> click on Firebase, please connect your project with firebase via Firebase Assistant.
Try to clean and build project once.
that's it.