Question

I am creating a new account using AccountManager and it works fine for android 2.3+ but for android 2.1 it makes the phone's address-book crash when trying to view a contact details.

The account is defined like this:

type: com.example.android.authenticators.ABCAuthenticator.account

name: Contacts ABC

The crash I see when trying to open a contact's detail activity (not on my app, which works fine, but on the Motorola 2.1's native contacts app) is:

V/ContactsListActivity( 1667): onListItemClick :Uri =  content://com.android.contacts/contacts/lookup/0r42-29292929/42
I/ActivityManager( 1017): Starting activity: Intent { act=android.intent.action.VIEW dat=content://com.android.contacts/contacts/lookup/0r42-29292929/42 cmp=com.android.contacts/.ViewContactActivity }
D/AndroidRuntime( 1667): Shutting down VM
W/dalvikvm( 1667): threadid=1: thread exiting with uncaught exception (group=0x4001ac68)
E/AndroidRuntime( 1667): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 1667): java.lang.IllegalStateException: Couldn't find authenticator for specific account type
E/AndroidRuntime( 1667):    at com.android.contacts.model.Sources.findAuthenticator(Sources.java:253)
E/AndroidRuntime( 1667):    at com.android.contacts.model.Sources.queryAccounts(Sources.java:193)
E/AndroidRuntime( 1667):    at com.android.contacts.model.Sources.<init>(Sources.java:109)
E/AndroidRuntime( 1667):    at com.android.contacts.model.Sources.getInstance(Sources.java:93)
E/AndroidRuntime( 1667):    at com.android.contacts.ViewContactActivity.buildEntries(ViewContactActivity.java:1372)
E/AndroidRuntime( 1667):    at com.android.contacts.ViewContactActivity.bindData(ViewContactActivity.java:681)
E/AndroidRuntime( 1667):    at com.android.contacts.ViewContactActivity.considerBindData(ViewContactActivity.java:674)
E/AndroidRuntime( 1667):    at com.android.contacts.ViewContactActivity.onQueryComplete(ViewContactActivity.java:542)
E/AndroidRuntime( 1667):    at com.android.contacts.util.NotifyingAsyncQueryHandler.onQueryComplete(NotifyingAsyncQueryHandler.java:65)
E/AndroidRuntime( 1667):    at android.content.AsyncQueryHandler.handleMessage(AsyncQueryHandler.java:408)
E/AndroidRuntime( 1667):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1667):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1667):    at android.app.ActivityThread.main(ActivityThread.java:4695)
E/AndroidRuntime( 1667):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1667):    at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1667):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
E/AndroidRuntime( 1667):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:663)
E/AndroidRuntime( 1667):    at dalvik.system.NativeStart.main(Native Method)
I/Process ( 1017): Sending signal. PID: 1667 SIG: 3
I/dalvikvm( 1667): threadid=3: reacting to signal 3

It seems like it tries to find the authenticator but it does not find it... but why? Are there any limitations on the name / type of the authenticator for Android 2.1? Any ideas?

Was it helpful?

Solution

Turns out my sync-adapter was using a @string reference for the android:accountType attribute and for Android 2.1 it needs to be a hardcoded string, not the reference.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top