当我使用Android帐户经理进行帐户前预约时,然后当我选择一个特定帐户时,由于AuthenticatorException,Android应用程序很快停止了
错误:
12-14 15:08:19.410: E/AndroidRuntime(11571): java.lang.RuntimeException: android.accounts.AuthenticatorException: UNREGISTERED_ON_API_CONSOLE
12-14 15:08:19.410: E/AndroidRuntime(11571): at com.ibdtd.cloudprinter.MainActivity$OnTokenAcquired.run(MainActivity.java:525)
12-14 15:08:19.410: E/AndroidRuntime(11571): at android.accounts.AccountManager$11.run(AccountManager.java:1438)
12-14 15:08:19.410: E/AndroidRuntime(11571): at android.os.Handler.handleCallback(Handler.java:733)
12-14 15:08:19.410: E/AndroidRuntime(11571): at android.os.Handler.dispatchMessage(Handler.java:95)
12-14 15:08:19.410: E/AndroidRuntime(11571): at android.os.Looper.loop(Looper.java:146)
12-14 15:08:19.410: E/AndroidRuntime(11571): at android.app.ActivityThread.main(ActivityThread.java:5602)
12-14 15:08:19.410: E/AndroidRuntime(11571): at java.lang.reflect.Method.invokeNative(Native Method)
12-14 15:08:19.410: E/AndroidRuntime(11571): at java.lang.reflect.Method.invoke(Method.java:515)
12-14 15:08:19.410: E/AndroidRuntime(11571): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
12-14 15:08:19.410: E/AndroidRuntime(11571): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
12-14 15:08:19.410: E/AndroidRuntime(11571): at dalvik.system.NativeStart.main(Native Method)
12-14 15:08:19.410: E/AndroidRuntime(11571): Caused by: android.accounts.AuthenticatorException: UNREGISTERED_ON_API_CONSOLE
12-14 15:08:19.410: E/AndroidRuntime(11571): at android.accounts.AccountManager.convertErrorToException(AccountManager.java:1737)
12-14 15:08:19.410: E/AndroidRuntime(11571): at android.accounts.AccountManager.access$400(AccountManager.java:145)
12-14 15:08:19.410: E/AndroidRuntime(11571): at android.accounts.AccountManager$AmsTask$Response.onError(AccountManager.java:1583)
12-14 15:08:19.410: E/AndroidRuntime(11571): at android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69)
12-14 15:08:19.410: E/AndroidRuntime(11571): at android.os.Binder.execTransact(Binder.java:404)
12-14 15:08:19.410: E/AndroidRuntime(11571): at dalvik.system.NativeStart.run(Native Method)
错误:
private class OnTokenAcquired implements AccountManagerCallback<Bundle> {
@Override
public void run(AccountManagerFuture<Bundle> result) {
try {
Bundle bundle = result.getResult();
Intent launch = (Intent) bundle.get(AccountManager.KEY_INTENT);
if (launch != null) {
startActivityForResult(launch, AUTHORIZATION_CODE);
} else {
String token = bundle
.getString(AccountManager.KEY_AUTHTOKEN);
authPreferences.setToken(token);
Log.e("AuthApp", authPreferences.getToken());
}
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
}
答案 0 :(得分:0)
您必须通过开发控制台注册已签名的应用。这是基于应用程序包名称和sha1指纹的安全措施。
要做到这一点,你必须: