SendBird UiKit using androidx.core.content.FileProvider directly

After adding a FileProvider to my application’s AndroidManifest, I started getting the following error.

/main/AndroidManifest.xml:40:13-69 Error:

Attribute provider#androidx.core.content.FileProvider@authorities value=(com.myapp.provider) from AndroidManifest.xml:40:13-69 is also present at [com.sendbird.sdk:uikit:2.1.5] AndroidManifest.xml:107:13-60 value=(com.myapp.provider).

Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml:38:9-48:20 to override.

In the UiKit’s Android Manifest, I can see another FileProvider is being declared.

    android:grantUriPermissions="true" >
        android:resource="@xml/sb_file_paths" />

Note that the error only happens when the same provider android:name is used. I have created an empty subclass and declared it in the AndoirdManifest and it works fine. I would also assume that following the suggestion of overriding the AndroidManifest definition will break things on the SendBird UiKit sdk, although I haven’t really tested it.

I do not want my app to query SendBird defined file provider for separation of concerns and general rule of not depending on libraries implementations, hence this request:

Would it be possible for the team to create a SendBird specific subclass of the FileProvider and an authority?

I think this makes sense, as it makes the SendBird sdk easier to integrate and less intrusive to app developers.

Any thoughts?

Thanks in advance.

Hi @robertoestivill
Thank you for your suggestion.

If there is no issue after testing it, we will include it and release it.
Thank you!

Before the release, you can use

tools:replace or your subcalss of the FileProvider.

1 Like

tools:replace will only make sense to use if I decide to override the SendBird FileProvider definition, which I believe it will break the SendBird sdk, as the authority and provider paths might be different.

Since I’m going with my own subclass for now, tools:replace is not needed.

1 Like

Good! Thank you! If we release it, I will let you know.

1 Like

Sorry, We will not implement it because it cannot resolve the manifest merge issue.
I recommend to define the right paths to .xml file of app.

Please see my latest comment on the other thread.

The issue is not an merger override. Along with subclassing FileProvider you need to provide a SendBird specific authority.