0

I'm using different Flavours in my project and i had to use some code to save pictures in my internal storage.

The documentation/link i read says that i have to put this in my android manifest:

 <provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="com.q4tech.magazine.fileprovider"
        android:grantUriPermissions="true"
        android:exported="false">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/filepaths" />
    </provider>

It works perfectly. I can save the pictures with no problem BUT now i cant install others flavors in my phone because of this error:

10/10 15:46:45: Launching 'app' on samsung SM-G9650. Installation did not succeed. The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER Installation failed due to: 'null' Retry

I don't know what else to do. I don't understand the problem.

Ciro González
  • 357
  • 1
  • 4
  • 14
  • i am facing the same issue in my case i used `com.freshdesk.helpdesk.provider` this and i set this line in provider tag `android:authorities="${applicationId}.com.freshdesk.helpdesk.provider"` still facing the same issue note:- with flavours – Arbaz.in Sep 23 '20 at 13:02

1 Answers1

4

Do your flavors have various package names? If yes, they will get installed without uninstalling the previous flavor. All of the flavors will try to register a Provider with the same authority (com.q4tech.magazine.fileprovider in your case).

Uninstalling the previous flavor should solve the problem. However, if you want to have multiple flavors simultaneously installed on a single device, you can make the authorities package-specific, like this:

<provider
...
android:authorities="${applicationId}.fileprovider"/>
  • Which one is correct this `android:authorities="${applicationId}.fileprovider"` OR this `android:authorities="${applicationId}.com.q4tech.magazine.fileprovider"`? – Arbaz.in Sep 23 '20 at 13:28
  • 1
    @Arbaz.in both should work fine, so it's up to you which one to choose. The important thing, in this case, is to use the `${applicationId}` because it is different across the flavors. – Wojciech Januszek Sep 26 '20 at 16:36
  • Actully issue with my hard coded packeg in some class file thanks for the response – Arbaz.in Sep 28 '20 at 05:48