INSTALL FAILED CONFLICTING PROVIDER问题完美解决方案
来源:互联网 发布:排百度搜索优化软件 编辑:程序博客网 时间:2024/06/17 02:35
INSTALL FAILED CONFLICTING PROVIDER.png
在安装Android应用时出现INSTALL FAILED CONFLICTING PROVIDER问题,是不是感觉很抓狂呢,下面就跟大家分享一下出现这个问题的原因及解决方案。
问题原因
在Android中authority要求必须是唯一的,比如你在定义一个provider时需要为它指定一个唯一的authority。如果你在安装一个带有provider的应用时,系统会检查当前已安装应用的authority是否和你要安装应用的authority相同,如果相同则会弹出上述警告,并且安装失败。
解决方案
在定义provider是,使用软编码的形式,如下:
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:grantUriPermissions="true" android:exported="false"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /></provider>
上述代码中通过${applicationId}.fileprovider的形式来指定provider的authorities,所以该provider的authorities会根据applicationId的不同而不同,从而避免了authorities的冲突问题。
那么如何使用刚才定义的authorities呢?
我们在定义authorities是采用了applicationId+fileprovider的形式,在获取authorities的时候,我们就可以通过包名+fileprovider来获取,代码如下:
public final static String getFileProviderName(Context context){ return context.getPackageName()+".fileprovider";}
阅读全文
0 0
- INSTALL FAILED CONFLICTING PROVIDER问题完美解决方案
- INSTALL FAILED CONFLICTING PROVIDER问题完美解决方案
- Android INSTALL FAILED CONFLICTING PROVIDER错误
- install failed with message INSTALL_FAILED_CONFLICTING_PROVIDER 解决方案
- Failed to import Gradle project完美解决方案
- 解决Eclipse插件升级中Cannot complete the install because of a conflicting dependency的问题
- 解决Eclipse插件升级中Cannot complete the install because of a conflicting dependency的问题
- 解决Eclipse插件升级中Cannot complete the install because of a conflicting dependency的问题
- 解决Eclipse插件升级中Cannot complete the install because of a conflicting dependency的问题
- JBulder中文问题完美解决方案
- GWT中文问题完美解决方案
- ADT在eclipse中重装时的问题--Cannot complete the install because of a conflicting dependency
- 解决方案:Failed to install helloworld.apk on device 'emulator-5554'
- 解决方案:Failed to install *.apk on device 'emulator-5554'
- Failed to install HelloWorld.apk on device 'emulator-5554! 解决方案
- 关于“The underlying provider failed on Open”的问题
- centos install python 问题及解决方案
- JBuilder中文问题完美解决方案(转)
- ceshi
- Git入门学习笔记(一) 仓库创建
- 神奇的Gamma函数(scipy)
- C库 文件操作
- springboot 类配置
- INSTALL FAILED CONFLICTING PROVIDER问题完美解决方案
- 安卓实现分业务模块异常捕获,全局异常不崩溃,应用继续运行!
- 了解Webhooks
- JPA规范与ORM框架之间的关系是怎样的呢?
- AngularJs的POST
- 在CentOS7.4中安装jdk的几种方法及配置环境变量
- http://blog.csdn.net/azhengye
- Spring MVC 集成 Thymeleaf
- 利用react-native构建一个新项目