添加到清单中的 AndroidX androidx.core.content.FileProvider 在清单上给出错误;清单合并失败并出现多个错误,请参阅日志

问题描述

enter image description here

上面的代码是我的 provider_paths.xml

然后我将其添加到我的清单中

/// registers a type so that a new instance will be created on each call of [getAsync]
/// on that type based on up to two parameters provided to [getAsync()]
/// the creation function is executed asynchronously and has to be accessed  with [getAsync]
/// [T] type to register
/// [P1] type of  param1
/// [P2] type of  param2
/// if you use only one parameter pass void here
/// [func] factory function for this type that accepts two parameters
/// [instanceName] if you provide a value here your factory gets registered with that
/// name instead of a type. This should only be necessary if you need to register more
/// than one instance of one type. Its highly not recommended
///
/// example:
///    getIt.registerFactoryParam<TestClassparam,String,int>((s,i) async
///        => TestClassparam(param1:s,param2: i));
///
/// if you only use one parameter:
///
///    getIt.registerFactoryParam<TestClassparam,void>((s,_) async
///        => TestClassparam(param1:s);
@override
void registerFactoryParamAsync<T,P1,P2>(
    FactoryFuncParamAsync<T,P2> func,{String instanceName}) {
  _register<T,P2>(
      type: _ServiceFactoryType.alwaysNew,instanceName: instanceName,factoryFuncParamAsync: func,isAsync: true,shouldSignalReady: false);
}

然后当我尝试运行该应用程序时,它给了我错误 清单合并因多个错误而失败,请参阅日志

然后合并清单给我看这个

enter image description here

谁能帮我解决这个问题?我目前使用的是 android X。

解决方法

由于错误信息建议您这样做,

<provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="com.packagename.package.provider"
            android:exported="false"
            android:grantUriPermissions="true"
            tools:replace="android:authorities">
        <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" 
                tools:replace="android:resource"
/>
    </provider>

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...