我正在使用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>

其他回答

如果你只需要使用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无关,我很抱歉,但它可能会帮助许多其他有这个问题的人。我在其他地方找不到确切的答案。

我尝试了很多方法,但都没有找到一个解决方案: 我在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>

我在几个应用程序中使用一个库时遇到了类似的问题。有必要用下面的提供者声明更新你的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> 

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

如果您正在使用提供者检查,并按照以下方法进行检查

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

或者使用它

    <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/provider_path" />
    </provider>

此外,如果应用程序已经退出在您的移动卸载,然后检查