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


当前回答

如果你在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

其他回答

它帮助了我:进入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>

这是显而易见的,但也要确保你没有在android中混淆了对applicationId的引用:权威。

在我的例子中,我犯了一个错误,漏掉了该死的美元符号:

android:authorities="{applicationId}.myprovider"

而不是:

android:authorities="${applicationId}.myprovider"

这不会立即导致任何错误(因为它是有效的权威名称)。但几天后,当我尝试安装一个应用程序的不同变体时,要了解错误是什么真的很痛苦,因为错误消息没有提供关于内容提供者错误的太多信息。

解决此问题的另一种方法是比较合并的清单,寻找相同的权限。

如果你使用Facebook内部应用程序检查供应商标签内AndroidManifest文件,并检查你的项目Id是正确的android:权威

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

我有这个错误,当实现一个库与以下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>

我在几个应用程序中使用一个库时遇到了类似的问题。有必要用下面的提供者声明更新你的AndroidManifest.xml。

<manifest ...>
    <application ...>
        <provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.here.this.library.provider" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities">
        </provider>
    </application>  
</manifest>