EasyImage icon indicating copy to clipboard operation
EasyImage copied to clipboard

Manifest merger failed with multiple errors, see logs

Open mustafal opened this issue 6 years ago • 7 comments

I had use your library, but it has following error i get

13-80 Error: Attribute provider#android.support.v4.content.FileProvider@authorities value=(com.serpentcs.littlebits.easyphotopicker.fileprovider) from [com.github.jkwiecien:EasyImage:1.3.1] AndroidManifest.xml:14:13-80 is also present at [:scanlibrary] AndroidManifest.xml:33:13-60 value=(com.serpentcs.littlebits.provider). Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml:12:9-20:20 to override.

17-50 Error: Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/filepaths) from [com.github.jkwiecien:EasyImage:1.3.1] AndroidManifest.xml:19:17-50 is also present at [:scanlibrary] AndroidManifest.xml:38:17-55 value=(@xml/provider_paths). Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.

I had tried the suggestion but the error still come

mustafal avatar Feb 28 '18 14:02 mustafal

I am also facing this error. Need to fix this issue for android Nougat and Oreo version...

rezaul99 avatar Mar 06 '18 05:03 rezaul99

I am also facing this error.

BuntyR avatar Apr 19 '18 10:04 BuntyR

Please how fixed this probleeeeeem!

jonathanherow avatar May 11 '18 16:05 jonathanherow

try to add this in AndroidManifest.xml inside <application

 <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="${applicationId}.easyphotopicker.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/filepaths" />
        </provider>

and find this file( @xml/filepaths ) with library

edit something

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path
        name="external_storage_root"
        path="." />
    <external-cache-path
        name="fileExternal"
        path="." />
    <cache-path
        name="fileCache"
        path="." />
</paths>

try to run

shoucanjun avatar May 14 '18 09:05 shoucanjun

To fix this problem just do what the error message says, i.e. make your provider declaration in AndroidManifest.xml look like this:

    <provider
        tools:replace="android:authorities"
        android:name="android.support.v4.content.FileProvider"
        android:authorities="${applicationId}.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            tools:replace="android:resource"
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_paths" />
    </provider>

EDIT: Scratch that, the REAL solution is to extend android.support.v4.content.FileProvider as an empty custom class and use it instead of android:name="android.support.v4.content.FileProvider".

axper avatar Jun 12 '18 07:06 axper

@axper and @shoucanjun , Thanks for your response, But I had tried that things, though can't get the actual result. Actually the thing is I had used another third party library so the manifest of the both library had same attribute or tag. so I had tried all the things on the internet and also tried myself, but cant get it

mustafal avatar Jun 21 '18 07:06 mustafal

@axper tools:replace actually works on my end.

@mustafal After reading the error log I believe there is conflice between the values of android:resource of EasyImage and android:resource of the scanlibrary. So I think you can copy the content of @xml/file_paths of the EasyImage library and @xml/provider_paths of the scanlibrary into one xml file in your res/xml folder and resolve any possible conflicts. Then you use tools:replace="android:resource" in the <provider> tag of your AndroidManifest.xml to override the other two, since yours have both of their content. That's what I came up with after reading this https://developer.android.com/studio/build/manifest-merge. Hope it works!

vv-23 avatar Aug 15 '18 19:08 vv-23