我正在使用Android SDK中的NotesList示例程序进行试验。我在程序中做了轻微的更改,但是当我安装我的编辑版本时,当我尝试在设备上已经安装原始notes程序时,我在控制台中一直得到消息INSTALL_FAILED_CONFLICTING_PROVIDER。我需要在提供者中更改什么以使其成为唯一的数据库?如果我卸载原来的notes程序,然后安装我编辑过的版本,它就可以正常工作。


当前回答

可能是您在清单中声明的授权机构+提供者名称

其他回答

        need to use android:name="androidx.core.content.contentprovider 
        or android:name="androidx.core.content.provider insteadof 
        android:name="androidx.core.content.fileprovider

        <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="${applicationId}.contentprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/filepaths" />
    </provider>

重命名包后可能会出现相同的错误。从AndroidManifest.xml中检查android:权威的string.xml中的值。

<provider
        android:authorities="@string/content_authority"
        android:name=".data.Provider"
        ... />

在string.xml中,该值应该与manifest中声明的包名相同。

<string name="content_authority">com.whatever.android.sunshine.app</string>

如果您正在使用Facebook SDK,那么问题可能在于您为Facebook提供商提供的“权限”值。

取代,

<provider
        android:name="com.facebook.FacebookContentProvider"
        android:authorities="com.facebook.FacebookContentProvider"
        android:exported="true" />

与- - - >

<provider
        android:name="com.facebook.FacebookContentProvider"
        android:authorities="com.facebook.FacebookContentProvider[YOUR_APP_ID]"
        android:exported="true" />

您可能需要更改defaultConfig。ApplicationId也在其他答案中建议。

我尝试了很多方法,但都没有找到一个解决方案: 我在AndroidManifest中修改了这个

<provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="com.com.shareFile"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
  </provider>

遇到这个问题。

解决方法:

1 -打开AndroidManifest.xml

2 - ctrl+f查找“provider”

3 -找到提供者并更新你的根目录名。

运行项目。希望问题会得到解决!