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


当前回答

当你安装了旧版本的应用程序并对(支持)库或清单文件进行了更改时,也会发生这种情况。删除旧的应用程序从您的设备(设置->应用程序-> <您的应用程序> ->卸载)将解决这个问题。

其他回答

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

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

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

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

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

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

如果你只需要使用facebook来登录你的应用程序,这里有一个提示: (此修复在cordova项目中工作) 必须完成步骤1和步骤2才能修复该问题。

1. 找到这个文件:platform/android/android.json 在该文件中: 删除此代码:

,{"xml": "<provider android:authorities=\"com.facebook.app.FacebookContentProvider<FACEBOOK_APP_ID>\" android:exported=\"true\" android:name=\"com.facebook.FacebookContentProvider\" />","count": 1
}

然后定位文件:platforms/android/app/src/main/androidManifest.xml

删除此代码:

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

现在应用程序可以运行良好.. 如果这个答案与OP无关,我很抱歉,但它可能会帮助许多其他有这个问题的人。我在其他地方找不到确切的答案。