TakePhoto
TakePhoto copied to clipboard
两个项目同时引用TakePhoto,不能同时安装成功fileProvider冲突问题
您好,有个问题寻求解决办法:
如题,多个项目同时引用TakePhoto,多个项目没办法同时安装,安装的时候报错
Installation failed with message Failed to finalize session : INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed in /data/app/com.xxx.xxx-1: Can't install because provider name com.jph.takephoto.fileprovider (in package com.xxx.xxx) is already used by com.xxx.xxx.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
说是另一个项目已经引用了com.jph.takephoto.fileprovider,需要卸载另一个项目才能安装当前项目
尝试解决:尝试使用自定义类public class MyProvider extends FileProvider
清单文件:<provider
android:name=".utils.MyProvider"android:authorities="${applicationId}.fileProvider"android:exported="false"android:grantUriPermissions="true" tools:replace="name,authorities,exported,grantUriPermissions">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"android:resource="@xml/my_file_paths" tools:replace="name,resource"/>
my_file_path.xml文件: