ContentProvider的authorities属性

Posted by 程序亦非猿 on 2015-12-10

ContentProvider

authorities属性的唯一性

关于ContentProvider,一直都了解不多,最近遇到个问题.
我们两个App都用了一个第三方库,当我想同时安装我们的App时,遇到了一个错误:INSTALL FAILED CONFLICTING PROVIDER,一直安装失败.

搜索了一遍后在SF上找到了答案

原来android:authorities must be unique.

To avoid conflicts, authority names should use a Java-style naming convention (such ascom.example.provider.cartoonprovider). Typically, it's the name     of the ContentProvider subclass that implements the provider

在xml里配置authorities属性必须唯一,所以当我们两个app配置得一样时,就会失败,于是修改一下这个属性即可.

资料

manifest/provider-element.html