Ciro González
Ciro González

Reputation: 367

Android - Problem with <provider> INSTALL_FAILED_CONFLICTING_PROVIDER

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.

Upvotes: 0

Views: 663

Answers (1)

Wojciech Januszek
Wojciech Januszek

Reputation: 651

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"/>

Upvotes: 4

Related Questions