错误 The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER

时间:2024-03-12 22:13:43

一次偶然,调试百度推送Demo时出现这个问题:

错误 The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDERINSTALL_FAILED_CONFLICTING_PROVIDER

List of apks:
[0] '/Users/****/Downloads/Baidu-Push-SDK-Android-L2-7.0.0.27/PushDemo_AS/app/build/outputs/apk/debug/app-debug.apk'
Installation failed due to: 'null'

 

网上查了很多地方,大多是说AndroidManifest.xml中有重复的配置导致的错误,比如

权限,或provider中的:android:authorities

我查了好几遍,删除了Demo中的重复文件还是报错,最后偶然看到了一篇文章,说是进程Id 重复,我一下豁然开朗,这个错误之前遇到过呀,于是修改了一下包名与进程Id 果然 可以正常运行安装了

全局修改包名(其余类名、方法名、变量名也可以这样改哦):

错误 The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER

 

下图是修改名称之后  当前名称涉及到的文件列表,点击Do Refactor 即可,这一步 会把整个项目中相关的东西统一更改了

错误 The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER

 

进程Id 也就是applicationId  在 App包下面的 build.gradle 文件中 找 defaultConfig 方法,里面有属性applicationId 就更改一下,没有的话 就添加一个:

错误 The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER