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


当前回答

重命名包后可能会出现相同的错误。从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>

其他回答

重命名包后可能会出现相同的错误。从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>

它帮助了我:进入AndroidManifest并粘贴或替换此代码

<provider
        android:authorities="${applicationId}.here.this.library.provider"
        android:name="androidx.core.content.FileProvider"
        android:exported="false"
        android:grantUriPermissions="true"
        tools:replace="android:authorities" >

    </provider>

如果你正在使用受众网络内容提供者,你需要在你的应用程序AndroidManifest.xml中添加这段代码

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

你的Facebook应用id是> 165632208074623

检查<provider标签下的android:authorities属性


检查您的包名称是否正确

我遇到了这样的问题:

Installation did not succeed.
The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER

但它不是来自舱单供应商 我的应用程序中的以下库与其他应用程序有冲突,其他应用程序无法安装:

implementation 'com.iceteck.silicompressorr:silicompressor:2.2.1'