我正在使用 Facebook android SDK 3.0(对它来说很新),并运行SessionLoginSample
位于下载 SDK 示例目录中的示例。目标是测试会话登录示例是否可以在未安装 Facebook for Android 应用程序的情况下触发浏览器并将用户引导至 Facebook 登录页面。没有运气,SessionLoginSample
部队关闭了。
但是,如果安装了 Android 版 Facebook 应用程序,用户可能会被引导到该应用程序的登录活动。输入帐户/密码然后返回SessionLoginSample
没有任何问题。看起来Session 对象不会触发浏览器并将用户引导到 Facebook 登录页面?
编辑:附加日志
02-10 15:35:46.180: ERROR/AndroidRuntime(29604): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to resume activity {com.facebook.samples.sessionlogin/com.facebook.LoginActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x7f050012
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2455)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2483)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1997)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4511)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f050012
at android.content.res.Resources.getText(Resources.java:260)
at android.content.res.Resources.getString(Resources.java:344)
at android.content.Context.getString(Context.java:282)
at com.facebook.widget.WebDialog.onCreate(WebDialog.java:188)
at android.app.Dialog.dispatchOnCreate(Dialog.java:353)
at android.app.Dialog.show(Dialog.java:257)
at com.facebook.AuthorizationClient$WebViewAuthHandler.tryAuthorize(AuthorizationClient.java:461)
at com.facebook.AuthorizationClient.tryCurrentHandler(AuthorizationClient.java:209)
at com.facebook.AuthorizationClient.tryNextHandler(AuthorizationClient.java:188)
at com.facebook.AuthorizationClient.authorize(AuthorizationClient.java:116)
at com.facebook.AuthorizationClient.startOrContinueAuth(AuthorizationClient.java:97)
at com.facebook.LoginActivity.onResume(LoginActivity.java:113)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1157)
at android.app.Activity.performResume(Activity.java:4544)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2445)
... 12 more
解决原问题:
刚刚发现strings.xml
Facebook安卓SDK的res文件夹中values文件夹中的文件被修改了!将WebDialog
字符串项复制回来后没有问题。很奇怪,我从不手动更改该文件。我IntelliJ IDEA 12
用作 IDE 来构建和运行我的项目。可能是这个问题引起的IntelliJ IDEA
??