android.accounts.AuthenticatorException: bind failure

I had the same situation. Searched everywhere but no luck. There are actually very few resources and tutorials for android authenticator. I also referred the same article udinic:write your own android authenticator.

It's not so detailed and its easy to get lost. I actually changed my accountType in authenticator.xml and forgot to change in AccountGeneral class. Both should be same, otherwise you activity won't bind to AuthenticatorService for callbacks.

authenticator.xml

<?xml version="1.0" encoding="utf-8" ?><account-authenticator 
xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="your_account_type_name"
    android:icon="@drawable/ic_navigate_before"
    android:smallIcon="@drawable/ic_navigate_before"
    android:label="@string/label"
    android:accountPreferences="@xml/prefs"/>

AccountGeneral.java

public class AccountGeneral {

/**
 * Account type id
 */
public static final String ACCOUNT_TYPE = "your_account_type_name";

/**
 * Account name
 */
public static final String ACCOUNT_NAME = "your_account_name";

/**
 * Auth token types
 */
public static final String AUTHTOKEN_TYPE_READ_ONLY = "Read only";
public static final String AUTHTOKEN_TYPE_READ_ONLY_LABEL = "Read only access to an FitDodo account";

public static final String AUTHTOKEN_TYPE_FULL_ACCESS = "Full access";
public static final String AUTHTOKEN_TYPE_FULL_ACCESS_LABEL = "Full access to an FitDodo account";

public static final ServerAuthenticate sServerAuthenticate = new ParseComServerAuthenticate();

}

I hope you find this helpful.

Tags:

Android