Both options are possible. However the first one would result in two separate Firebase projects, which is less managable. It's better to stick with one Firebase project and with the same app.
In short:
The package identifier should be different to make a difference between the debug and release variant in one project. We can distinct this by using the build type.
Next, the second identifier can be added to the Firebase project. Crashlytics will make the distinction between them in the app.
To achieve that, we can do the following.
1. In the Firebase Console
a. Go to the project settings.
b. Add an additional Android app with the following configuration:
- App identifier:
<app_identifier>.debug
- Name: // (Anything), make sure to mark it with something like
Debug
at the end
c. Register this app
d. Download the google-services.json
file, we will need it in the next step.
e. Go to the Crashlytics tab in the left menu
f. Enable Crashlytics for both the apps
- Press
Next
at the second step
- Ignore the third step, building the code will enable it
2. Android source
a. Place the google-services.json
file in the project (under the app
folder) -> Overwrite the old one
b. Open the app/build.gradle
file.
- Inside the
android
block, the buildTypes
will be shown.
- For the
debug
build type, add applicationIdSuffix '.debug'
(add the debug type if it doesn't exist in the file)
- This will cause the debug build type, to have
.debug
after the actual package identifier for the debug build.
- Release builds will be unaffected by this
c. Result, it should look like this:
android {
// ...
buildTypes {
debug {
applicationIdSuffix '.debug'
}
release {
// ...
}
}
}
3. Done!
Make a crash and it will result in the corresponding app in Firebase Crashlytics. There is a dropdown with both the projects at the top-left of the page.
Now, Crashlytics will automatically use the right Firebase app when sending a crash report. This works, since the google-services.json
actually contains the configuration for both the build types. Crashlytics will use the right one based on the package identifier.
Last note: Don't forget enable Crashlytics at the Crashlytics tab in the Firebase Console (as described in step 1f)