问题描述
上面的代码是我的 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);
}
然后当我尝试运行该应用程序时,它给了我错误 清单合并因多个错误而失败,请参阅日志
谁能帮我解决这个问题?我目前使用的是 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>