Change the application ID for build variants and product flavor

android {
    defaultConfig {
        applicationId "com.example.myapp"
    }
    productFlavors {
        free {
            applicationIdSuffix ".free"
        }
        pro {
            applicationIdSuffix ".pro"
        }
    }
}
android { 
    ...
    flavorDimensions "default"
    ...
}

It is better to use different AndroidManifest.xml and google-services.json file for each flavor

References
https://developer.android.com/studio/build/application-id
https://developers.google.com/android/guides/google-services-plugin
https://stackoverflow.com/questions/44105127/android-studio-3-0-flavor-dimension-issue
https://android.jlelse.eu/how-to-use-different-google-services-json-file-with-multiple-product-flavors-android-7853d98dd6c0
https://stackoverflow.com/questions/34990479/no-matching-client-found-for-package-name-google-analytics-multiple-productf
https://medium.com/@Miqubel/multiple-build-types-in-firebase-on-android-6f6715f6dd83
https://www.zidsworld.com/android-tutorials/here-is-how-to-fix-no-matching-client-found-for-package-name-on-android/