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


当前回答

如果你有不同的风格,你想避免在权威名称上的冲突,你可以添加一个applicationIdSuffix来构建类型,并在你的清单中使用结果的applicationId,如下所示:

<...
 android:authorities="${applicationId}.contentprovider"/>

其他回答

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

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

你的Facebook应用id是> 165632208074623

如果您正在使用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也在其他答案中建议。

您可以卸载名称为“com”的软件包。在你运行应用程序之后,你在其中运行应用程序的设备。这对我很有效

如果你在Xamarin上,你得到这个错误(可能是因为Firebase.Crashlytics):

INSTALL_FAILED_CONFLICTING_PROVIDER
Package couldn't be installed in [...]
Can't install because provider name dollar_openBracket_applicationId_closeBracket (in package [...]]) is already used by [...]

正如这里提到的,你需要更新Xamarin.Build.Download:

Update the Xamarin.Build.Download Nuget Package to 0.4.12-preview3 On Mac, you may need to check Show pre-release packages in the Add Packages window Close Visual Studio Delete all cached locations of NuGet Packages: On Windows, open Visual Studio but not the solution: Tools -> Option -> Nuget Package Manager -> General -> Clear All Nuget Cache(s) On Mac, wipe the following folders: ~/.local/share/NuGet ~/.nuget/packages packages folder in solution Delete bin/obj folders in solution Load the Solution Restore Nuget Packages for the Solution (should run automatically) Rebuild

我有这个错误,当实现一个库与以下AndroidmManifest.xml

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

当我在Project AndroidManifest.xml (app/src/main)中放入以下代码时,我解决了这个问题:

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