を呼び出すにもかかわらず、nullです。私は最近、Android 6.0デバイスに最新バージョンをインストールしましたが、奇妙なエラーが表示されました(4.2.2 & 5.1で完全に動作します)。GoogleAccountCredential名は、私は安全なバックエンドを使用してエンドポイントを作成したと私は(ソースドキュメント<a href="https://cloud.google.com/appengine/docs/java/endpoints/consume_android">here</a>)を構築していますアプリ3月以来、それを使用しているsetSelectedAccountName(アンドロイド6.0)
特定のエラーがある:
私は資格とエラーにトレースIllegalArgumentException: the name must not be empty: null
、あなたは以下のコードを見ることができます。 Android 6.0のアカウントは "[email protected]"ですが、文字列 'test'はnullになります。
GoogleAccountCredentialを変更6.0に関する具体的な何かがありますか?
public static GoogleAccountCredential getCredential(Context ctx) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
String account = prefs.getString(UserProfileHelper.PREF_USER_ACCOUNT, "");
GoogleAccountCredential credential = GoogleAccountCredential.usingAudience(ctx,
"server:client_id:MY_ACCOUNT_NUMS.apps.googleusercontent.com")
.setSelectedAccountName(account);
String test = credential.getSelectedAccountName();
return credential;
}
はすでにその権限が追加されました。 – easycheese
あなたはそれをリクエストしているのか、それともあなたのマニフェストに入っていますか? – AndroidEnthusiast
ああ、だめだ...それについて考えることさえしないで、糸くずがそれを捕まえるだろうと思うだろうか...それとも、より良いエラーが投げられるだろう。あなたはおそらく正しいですが、私はそれをテストします。マニフェストに追加 – easycheese