问题
I'm trying to create an Android App that uses Google's OAuth library, like this sample.
However, when I make a call to getAuthTokenByFeatures I get an exception that prints this out on LogCat:
05-24 10:56:58.224: W/System.err(557): android.accounts.AuthenticatorException: bind failure
05-24 10:56:58.236: W/System.err(557): at android.accounts.AccountManager.convertErrorToException(AccountManager.java:1563)
05-24 10:56:58.236: W/System.err(557): at android.accounts.AccountManager.access$400(AccountManager.java:140)
05-24 10:56:58.236: W/System.err(557): at android.accounts.AccountManager$AmsTask$Response.onError(AccountManager.java:1409)
05-24 10:56:58.236: W/System.err(557): at android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69)
05-24 10:56:58.236: W/System.err(557): at android.os.Binder.execTransact(Binder.java:338)
05-24 10:56:58.236: W/System.err(557): at dalvik.system.NativeStart.run(Native Method)
However, this does not happen with an actual Android device. I'm emulating Android 4.0.3 and could not for the life of me find an answer to this anywhere. Any ideas?
回答1:
This is usually seen when you don't declare the Authenticator in the manifest. See Creating a Stub Authenticator.
<service
android:name="com.example.android.syncadapter.AuthenticatorService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator"/>
</intent-filter>
<meta-data
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
</service>
来源:https://stackoverflow.com/questions/10736245/authenticatorexception-bind-failure-on-avd