Install shows error in console: INSTALL FAILED CON

2019-01-03 05:19发布

I am experimenting with the NotesList sample program in the Android SDK. I've made a slight variation in the program, but when I install my edited version I keep getting the message INSTALL_FAILED_CONFLICTING_PROVIDER in the console when I try to install it when the original notes program is already on the device. What do I need to change in the Provider to make it a unique database? It works fine if I uninstall the original notes program and then install my edited version.

15条回答
Evening l夕情丶
2楼-- · 2019-01-03 05:21

If you are using Facebook inside app check for provider tag inside AndroidManifest file and check your project Id is correct for android:authorities

<provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider112623702612345" android:exported="true" />
查看更多
地球回转人心会变
3楼-- · 2019-01-03 05:23

The authority, as listed in android:authorities must be unique. Quoting the documentation for this attribute:

To avoid conflicts, authority names should use a Java-style naming convention (such as com.example.provider.cartoonprovider). Typically, it's the name of the ContentProvider subclass that implements the provider

查看更多
Viruses.
4楼-- · 2019-01-03 05:25

I thought uninstalling the app by dragging its icon to "Uninstall" would solve the problem, but it did not.

Here is what solved the problem:

  1. Go to Settings
  2. Choose Apps
  3. Find your app (yes I was surprised to still find it here!) and press it
  4. In the top-right, press the 3 dots
  5. Select "Uninstall for all users"

Try again, it should work now.

查看更多
手持菜刀,她持情操
5楼-- · 2019-01-03 05:26

Encountered this issue.

Resolved it by:

1 - open AndroidManifest.xml

2 - ctrl+f find "provider"

3 - find provider and update your root directory name there.

run project. hopefully issue will be fixed!

查看更多
够拽才男人
6楼-- · 2019-01-03 05:27

The same error may occur after renaming packages. Check the value in string.xml for android:authorities from AndroidManifest.xml.

<provider
        android:authorities="@string/content_authority"
        android:name=".data.Provider"
        ... />

In string.xml the value should be the same as your package name, declared in manifest.

<string name="content_authority">com.whatever.android.sunshine.app</string>
查看更多
萌系小妹纸
7楼-- · 2019-01-03 05:30

If you are using the Facebook SDK then the issue might be in the "authorities" value you provide for the Facebook provider.

REPLACE -

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

WITH ->

<provider
        android:name="com.facebook.FacebookContentProvider"
        android:authorities="com.facebook.FacebookContentProvider[YOUR_APP_ID]"
        android:exported="true" />

You might need to change the defaultConfig.ApplicationId also as suggested in other answers.

查看更多
登录 后发表回答