出错场景 : 需要安装两个相同的 APP 进行对比测试 ;
对工程进行了如下修改 :
应用编译完成后 , 安装过程中报了如下错误 :
03/09 15:41:11: Launching 'XXX' on Google Pixel 2.
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER
List of apks:
[0] 'D:\002_Project\001_Android_Work\XXX\build\outputs\apk\debug\app-debug.apk'
Installation failed due to: 'null'
Retry
在清单文件 AndroidManifest.xml 中将 Application , Activity , Service 等路径修改成了全路径 包名.类名 , 这里漏掉了 provider , 配置了一个 FileProvider 用于访问 SD 卡中的文件 ;
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="xxx.fileProvider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
将上述 provider 中的 android:authorities , 修改成 新的包名.fileProvider ;
对应的 file_paths 中的 xml 文件中对应的包名 , 也要进行相应修改 ;