我正在使用https://github.com/jkwiecien/EasyImage中的EasyImage库。
我在AndroidManifest.xml
:
<provider
android:name="`"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
编译时出现此gradle错误:
/home/babken/.../AndroidManifest.xml:216:13-64 Error:
Attribute provider#android.support.v4.content.FileProvider@authorities value=(com...fileprovider) from AndroidManifest.xml:216:13-64
is also present at [com.github.jkwiecien:EasyImage:1.3.1] AndroidManifest.xml:14:13-80 value=(com...easyphotopicker.fileprovider).
Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml:214:9-222:20 to override.
/home/babken/.../AndroidManifest.xml:221:17-51 Error:
Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/file_paths) from AndroidManifest.xml:221:17-51
is also present at [com.github.jkwiecien:EasyImage:1.3.1] AndroidManifest.xml:19:17-50 value=(@xml/filepaths).
Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml:219:13-221:54 to override.
答案 0 :(得分:1)
解决方案是使用您的自定义类扩展android.support.v4.content.FileProvider
并改为使用它:
package com....utils;
import android.support.v4.content.FileProvider;
public class CustomFileProvider extends FileProvider {
}
在清单中使用它:
<provider
android:name=".utils.CustomFileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>