Một số mẹo hữu ích khác để gỡ lỗi các vấn đề như thế này.
Đầu tiên hãy bật tính năng ghi nhật ký chi tiết cho một số thẻ:
$ adb shell setprop log.tag.AccountManagerService VERBOSE
$ adb shell setprop log.tag.Accounts VERBOSE
$ adb shell setprop log.tag.Account VERBOSE
$ adb shell setprop log.tag.PackageManager VERBOSE
Bạn sẽ thấy ghi nhật ký như thế này:
V/AccountManagerService: initiating bind to authenticator type com.example.account
V/Accounts: there is no service connection for com.example.account
V/Accounts: there is no authenticator for com.example.account, bailing out
D/AccountManagerService: bind attempt failed for Session: expectLaunch true, connected false, stats (0/0/0), lifetime 0.002, addAccount, accountType com.example.account, requiredFeatures null
Có nghĩa là không có người xác thực nào đăng ký cho loại tài khoản này. Để xem trình xác thực nào được đăng ký, hãy xem nhật ký khi cài đặt gói:
D/PackageManager: encountered new type: ServiceInfo: AuthenticatorDescription {type=com.example.account}, ComponentInfo{com.example/com.example.android.AuthenticatorService}, uid 10028
D/PackageManager: notifyListener: AuthenticatorDescription {type=com.example.account} is added
Tôi đã gặp sự cố khi trình mô tả xml của trình xác thực tham chiếu đến tài nguyên chuỗi không được giải quyết đúng cách trong quá trình cài đặt:
android:accountType="@string/account_type"
Các bản ghi cho thấy
encountered new type: ServiceInfo: AuthenticatorDescription {type=@2131231194}, ...
Thay thế nó bằng một chuỗi bình thường (không phải tài nguyên) đã giải quyết được vấn đề. Đây có vẻ là Android 2.1 cụ thể.
android:accountType="com.example.account"