为什么我不能使用这两个同步适配器安装应用程序版本?
问题描述:
我试图用两个不同的同步适配器设置应用程序,但软件包安装程序不满意我的提供程序声明。 它说为什么我不能使用这两个同步适配器安装应用程序版本?
Failure [INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed in /data/app/com.daykm.tiger-1: Can't install because provider name com.daykm.tiger.mentions (in package com.daykm.tiger) is already used by com.daykm.tiger]
,但我没有看到在提供者名称冲突。
这里的清单中的服务和提供者:
<service
android:name=".sync.TimelineSyncService"
android:enabled="true"
android:exported="true"
android:process=":sync">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/timelinesync" />
</service>
<service
android:name=".sync.MentionsSyncService"
android:enabled="true"
android:exported="true"
android:process=":sync">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/mentionsync" />
</service>
<provider
android:name="com.daykm.tiger.sync.TwitterContentProvider"
android:authorities="com.daykm.tiger.timeline;com.daykm.tiger.mentions"
android:exported="false"
android:syncable="true" />
mentionsync.xml:
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter
xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="@string/authority_mentions"
android:accountType="@string/account_type"
android:userVisible="false"
android:supportsUploading="false"
android:allowParallelSyncs="false"
android:isAlwaysSyncable="false"/>
timelinesync.xml:所有
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter
xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="@string/authority_timeline"
android:accountType="@string/account_type"
android:userVisible="false"
android:supportsUploading="false"
android:allowParallelSyncs="false"
android:isAlwaysSyncable="false"/>
account_sync.xml拿着串同步内容:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="account_type">tiger.com</string>
<string name="authority_timeline">com.daykm.tiger.timeline</string>
<string name="authority_mentions">com.daykm.tiger.mentions</string>
<string name="intent_name">database-change</string>
</resources>
答
将allowParallelSyncs的值从False更改为True。你也可以看看这个链接Android multiple sync adapter items like Google Account?
答
我认为您不能使用相同的accountType
创建2个同步适配器,请尝试对两个同步适配器使用两个不同的值。
我觉得有多个同步服务是你在系统菜单中System> accounts> accountType有多个列表的方式。这不是它的工作原理吗? – Daykm