我正在尝试将 Facebook 集成到我的应用程序中。但是一旦我点击fbphoto
它就会抛出错误android.content.res.Resources$NotFoundException
。我确实知道它会引发错误,因为在运行时没有建立适当的资源。
发现错误是在facebook.authorize(this, new String[] { "email", "publish_stream"}, new DialogListener() {}
. 但根本原因仍然缺失。
fbphoto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
loginToFacebook();
}
});
public void loginToFacebook()
{
if(!facebook.isSessionValid())
{
facebook.authorize(this, new String[] { "email", "publish_stream"}, new DialogListener() {
});
}
02-08 02:57:58.236: E/AndroidRuntime(1582): FATAL EXCEPTION: main
02-08 02:57:58.236: E/AndroidRuntime(1582): android.content.res.Resources$NotFoundException: String resource ID #0x7f050011
02-08 02:57:58.236: E/AndroidRuntime(1582): at android.content.res.Resources.getText(Resources.java:201)
02-08 02:57:58.236: E/AndroidRuntime(1582): at android.content.res.Resources.getString(Resources.java:254)
02-08 02:57:58.236: E/AndroidRuntime(1582): at android.content.Context.getString(Context.java:183)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.widget.WebDialog.onCreate(WebDialog.java:188)
02-08 02:57:58.236: E/AndroidRuntime(1582): at android.app.Dialog.dispatchOnCreate(Dialog.java:307)
02-08 02:57:58.236: E/AndroidRuntime(1582): at android.app.Dialog.show(Dialog.java:225)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.AuthorizationClient$WebViewAuthHandler.tryAuthorize(AuthorizationClient.java:462)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.AuthorizationClient.tryCurrentHandler(AuthorizationClient.java:210)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.AuthorizationClient.tryNextHandler(AuthorizationClient.java:189)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.AuthorizationClient.authorize(AuthorizationClient.java:117)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.AuthorizationClient.startOrContinueAuth(AuthorizationClient.java:98)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.Session.tryLegacyAuth(Session.java:1096)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.Session.authorize(Session.java:893)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.Session.open(Session.java:957)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.Session.openForPublish(Session.java:415)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.android.Facebook.openSession(Facebook.java:319)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.android.Facebook.authorize(Facebook.java:313)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.facebook.android.Facebook.authorize(Facebook.java:149)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.example.splashscreen.SecondScreen.loginToFacebook(SecondScreen.java:110)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.example.splashscreen.SecondScreen$1.onClick(SecondScreen.java:73)
02-08 02:57:58.236: E/AndroidRuntime(1582): at android.view.View.performClick(View.java:2485)
02-08 02:57:58.236: E/AndroidRuntime(1582): at android.view.View$PerformClick.run(View.java:9080)
02-08 02:57:58.236: E/AndroidRuntime(1582): at android.os.Handler.handleCallback(Handler.java:587)
02-08 02:57:58.236: E/AndroidRuntime(1582): at android.os.Handler.dispatchMessage(Handler.java:92)
02-08 02:57:58.236: E/AndroidRuntime(1582): at android.os.Looper.loop(Looper.java:123)
02-08 02:57:58.236: E/AndroidRuntime(1582): at android.app.ActivityThread.main(ActivityThread.java:3683)
02-08 02:57:58.236: E/AndroidRuntime(1582): at java.lang.reflect.Method.invokeNative(Native Method)
02-08 02:57:58.236: E/AndroidRuntime(1582): at java.lang.reflect.Method.invoke(Method.java:507)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-08 02:57:58.236: E/AndroidRuntime(1582): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-08 02:57:58.236: E/AndroidRuntime(1582): at dalvik.system.NativeStart.main(Native Method)