2016-08-21 45 views
0

我試圖用兩個不同的同步適配器設置應用程序,但軟件包安裝程序不滿意我的提供程序聲明。 它說爲什麼我不能使用這兩個同步適配器安裝應用程序版本?

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

我認爲您不能使用相同的accountType創建2個同步適配器,請嘗試對兩個同步適配器使用兩個不同的值。

+0

我覺得有多個同步服務是你在系統菜單中System> accounts> accountType有多個列表的方式。這不是它的工作原理嗎? – Daykm

相關問題