Reputation: 11329
Can anybody tell me how I can install different builds for different flavors on one device without getting a "duplicate provider" error message neither in PlayStore nor in AndroidStudio?
I have different flavors for different countries in my app and it's annoying to always uninstall the app before installing another one.
I tried:
productFlavors {
austria {
manifestPlaceholders = [
// prevent "duplicate provider authority" message
providerAuthority: "com.example.app.at",
]
}
germany {
manifestPlaceholders = [
// prevent "duplicate provider authority" message
providerAuthority: "com.example.app.de",
]
}
//...
}
and in my AndroidManifest I added:
android:authorities="${providerAuthority}"
to my
<application/>
tag. This doesn't solve my problem.
I don't use a ContentProvider so I also tried adding a Stub ContentProvider class to the project and declared android:authorities="${providerAuthority}" inside the
<provider/>
tag including the name of the Stub ContentProvider --> no success. I would be very happy about some other ideas or corrections.
UPDATE:
the error message I get from Android Studio when trying to install the app on my device.
Upvotes: 0
Views: 478
Reputation: 11329
I found the solution:
I lied when I said I didn't have a provider. I just didn't use it any more. So the solution for my problem was here (or simply deleting the unused provider): https://stackoverflow.com/a/24850080/3734116
I finally realized it by having a look into my generated / merged AndroidManifest in build/intermediates/manifests/ where I could find the Manifests for all my flavors. There I saw that one provider always had the same authority.
Another problem could have also been (but didn't apply to me)
Application ID not populated in AndroidManifest for libraries
Multiple apps using same authority provider name for AppMeasurementContentProvider
Upvotes: 0