androidcrashlytics-androidcrashlytics-beta

Crashlytics Beta build for Android will not install if production build exists: 'The package conflicts with an existing package by the same name'


Our team distributes beta build through Crashlytics and most of us have the production build installed on our phones. We aren't able to install the beta build without removing the production app. (Both builds have different applicationId, as in: prod: com.abc beta: com.abc.beta)

We tried using the same keystore (as production) and also a different one to sign the beta build, but it doesn't change anything.

Is there a way to install both beta and production builds on the same device?


Solution

  • After investigating the issue for some time, and thanks to the help from the Fabric team, I've managed to found the issue and also a way to resolve it.

    Using adb logcat, I've found the underlying error of the failure:

    Package attempting to redeclare permission com.abc.permission.C2D_MESSAGE already owned by 
    

    It appears that the beta app is trying to write to the same permission file that's owned by the production build. To avoid that, I edited my AndroidManifest.xml as follows:

    <uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
    <permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    

    So that the beta app has its own permission folder to write to.

    Hope this helps someone out there!