我尝试使用两个不同的同步适配器设置应用,但包安装程序对我的提供商声明并不满意。 它说
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>
答案 0 :(得分:1)
将allowParallelSyncs的值从False更改为True。您还可以查看此链接Android multiple sync adapter items like Google Account?
答案 1 :(得分:0)
我认为您无法使用相同的accountType
创建2个同步适配器,请尝试为两个同步适配器使用两个不同的值。