Android Sync Adapter - не удается явно добавить учетные записи типа ошибки - PullRequest
0 голосов
/ 08 мая 2019

Я пытаюсь создать Адаптер синхронизации Android, следуя инструкциям Android здесь . Тем не менее он возвращает следующую ошибку:

Причина: java.lang.SecurityException: uid 10081 не может явно добавить учетные записи типа: br.com.tarcisiofl.supply.syncaccount

sync_adapter.xml

<?xml version="1.0" encoding="utf-8"?>
<sync-adapter
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="br.com.tarcisiofl.supply.syncaccount"
    android:contentAuthority="br.com.tarcisiofl.supply"
    android:userVisible="false"
    android:supportsUploading="false"
    android:allowParallelSyncs="false"
    android:isAlwaysSyncable="true"/>

authenticator.xml

<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="br.com.tarcisiofl.supply.syncaccount"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:smallIcon="@mipmap/ic_launcher" />

AndroidManifest.xml - Сервис и поставщик

<service android:name=".repository.basicsyncadapter.AuthenticatorService2">
    <intent-filter>
        <action android:name="android.accounts.AccountAuthenticator2" />
    </intent-filter>
    <meta-data
        android:name="android.accounts.AccountAuthenticator2"
        android:resource="@xml/authenticator" />
</service>

<provider
    android:name=".repository.basicsyncadapter.provider.SupplyProvider2"
    android:authorities="br.com.tarcisiofl.supply"
    android:exported="false"
    android:syncable="true" />

AccountGeneral.java

public class AccountGeneral {
    private static final String ACCOUNT_TYPE = "br.com.tarcisiofl.supply.syncaccount";
    private static final String ACCOUNT_NAME = "Supply";
}

Может ли кто-нибудь указать мне, что не так?

...