Android 2.1:我的帐户身份验证器导致手机地址簿崩溃

时间:2014-01-15 12:16:21

标签: android android-authenticator

我正在使用AccountManager创建一个新帐户,它适用于Android 2.3+但是对于Android 2.1,它会在尝试查看联系人详细信息时导致手机地址簿崩溃。

帐户定义如下:

  

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

     

name: Contacts ABC

我在尝试打开联系人的详细活动时看到的崩溃(不在我的应用程序上,但工作正常,但在Motorola 2.1的本机联系人应用程序上)是:

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

似乎它试图找到验证器,但它找不到它......但为什么呢? Android 2.1的身份验证器的名称/类型是否有任何限制?有什么想法吗?

1 个答案:

答案 0 :(得分:0)

原来我的同步适配器使用@string引用作为android:accountType属性,而对于Android 2.1,它需要是一个硬编码字符串,而不是引用。