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


当前回答

我尝试了很多方法,但都没有找到解决方法。但是这个链接帮助了我……我想详细谈谈……

我正在运行Instrumented测试用例,所以我的应用程序在启动器中不可见…但它是安装的,因此使用相同的内容提供程序。所以,我应该卸载它。所以设置->应用程序管理器->所有下载的应用程序->卸载所有应用程序从您当前的开发包

现在,试着跑……这会有用的……

其他回答

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

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

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

在我的android设备上,我安装了不同版本的同一款应用。这给了我错误安装失败冲突提供者。 所以我卸载了同一款应用的所有版本。 和尝试

adb install -r /Users/demo-debug-92acfc5.apk

它解决了我的问题。

遇到这个问题。

解决方法:

1 -打开AndroidManifest.xml

2 - ctrl+f查找“provider”

3 -找到提供者并更新你的根目录名。

运行项目。希望问题会得到解决!

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