相关疑难解决方法(0)

AndroidManifest使用FileProvider合并错误

我正在尝试在其AndroidManifest.xml中使用具有此功能的库:

    <provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="${applicationId}.imagepicker.provider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/provider_paths"/>
    </provider>
Run Code Online (Sandbox Code Playgroud)

我的应用程序的AndroidManifest.xml中有相同的标记:

    <provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="@string/FileProviderAuthority"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_paths"></meta-data>
    </provider>
Run Code Online (Sandbox Code Playgroud)

所以它显然给出了Manifest合并错误:

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs
Run Code Online (Sandbox Code Playgroud)

这建议在AndroidManifest.xml中"添加"工具:replace ="android:authorities"'来覆盖".

所以我tools:replace="android:authorities"在我的应用程序的AndroidManifest.xml中添加如下:

<application
    tools:replace="android:authorities"
    android:name=".appcontroller.AppController"
    android:allowBackup="true"
    android:hardwareAccelerated="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
Run Code Online (Sandbox Code Playgroud)

然后我收到这个错误:

Error:
tools:replace specified at line:25 for attribute android:authorities, but no new value specified
Run Code Online (Sandbox Code Playgroud)

同样的事情发生在tools:replace="android.support.v4.content.FileProvider".

我错过了什么?

android android-manifest

18
推荐指数
4
解决办法
8934
查看次数

标签 统计

android ×1

android-manifest ×1