我試圖在我的項目中實現谷歌登錄,但它登錄後使用Gmail用戶名和密碼&,然後按下允許按鈕給我未知的主機錯誤。我還在構建提示中保存了android.playService.plus。其他構建提示也是必需的嗎?我沒有找到適當的文件或博客應用它作爲well.My代碼如下:谷歌登錄提供了錯誤
if (googleLogin.isNativeLoginSupported()) {
if (!googleLogin.isUserLoggedIn()) {
googleLogin.doLogin();
}
AccessToken at = googleLogin.getAccessToken();
System.out.println("token " + at.getToken()); // this value is null
} else {
if (!googleLogin.isUserLoggedIn()) {
googleLogin.doLogin();
System.out.println("not logged in : not native login");
}
}
googleLogin.setCallback(new LoginCallback() {
@Override
public void loginFailed(String errorMessage) {
Dialog.show("Login Faild", "Retry Login", "Retry", null);
google_signIn(res);
}
@Override
public void loginSuccessful() {
System.out.println("successfull");
new NewForm(res).show();
}
});
錯誤:
Received exception: Unknown host
java.lang.Throwable: Unknown host
at javafx.scene.web.WebEngine$LoadWorker.describeError(WebEngine.java:1402)
at javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(WebEngine.java:1341)
at javafx.scene.web.WebEngine$LoadWorker.access$1100(WebEngine.java:1219)
at javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(WebEngine.java:1206)
at com.sun.webkit.WebPage.fireLoadEvent(WebPage.java:2387)
at com.sun.webkit.WebPage.fwkFireLoadEvent(WebPage.java:2231)
at com.sun.webkit.network.URLLoader.twkDidFail(Native Method)
at com.sun.webkit.network.URLLoader.notifyDidFail(URLLoader.java:843)
at com.sun.webkit.network.URLLoader.lambda$didFail$93(URLLoader.java:826)
at com.sun.webkit.network.URLLoader$$Lambda$197/728465605.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292)
at com.sun.javafx.application.PlatformImpl$$Lambda$63/2017575979.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291)
at com.sun.javafx.application.PlatformImpl$$Lambda$62/1811810557.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java:102)
at com.sun.glass.ui.win.WinApplication$$Lambda$54/5182121.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
你能澄清一下,如果登錄本身仍然有效嗎? 你在設備上試過了嗎?這可能是模擬器代碼的失敗,因爲它的性質更脆弱 –
我發現的錯誤,youtube.com沒有在我的筆記本電腦上打開。我將重定向網址更改爲facebook.com,並且工作正常。在模擬器中,它被重定向到一個網頁(facebook.com)。如何打開新表單而不是重定向網頁?我不知道登錄是否成功。它不顯示登錄失敗對話框或'成功'登錄輸出frm setCallback方法。在設備中,情況更糟。它繼續顯示選擇賬戶,當選擇一個賬戶時,這個「選擇賬戶對話框」再次顯示。調試時我沒有收到任何錯誤但AccessToken爲空。 –