我已经在我的Xamarin Android应用程序中集成了最新的Facebook Android SDK 4.4.0,但它在这一行崩溃了:
FacebookSdk.SdkInitialize (this.ApplicationContext);
如果这是最新的Facebook Android SDK 4.4.0中的错误,请您告诉我吗?
07-29 14:54:26.595: E/mono-rt(10768): [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'Android.Runtime.JNIEnv.CallStaticVoidMethod'.
07-29 14:54:26.595: E/mono-rt(10768): at FacebookIntegrationSample.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00016] in c:\Users\user\Documents\Projects\FacebookIntegrationSample\FacebookIntegrationSample\MainActivity.cs:36
07-29 14:54:26.595: E/mono-rt(10768): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.App.Activity.cs:2380
07-29 14:54:26.595: E/mono-rt(10768): at (wrapper dynamic-method) object:8ee5b6e6-5b83-4c32-a791-78e06e74e8e7 (intptr,intptr,intptr)
我甚至试过运行Facebook Android SDK 4.4.0中提供的Sample,但它也在同一行崩溃:FacebookSdk.SdkInitialize(this.ApplicationContext);
答案 0 :(得分:0)
FacebookSdk.SdkInitialize (this.ApplicationContext);
在改变layout.like,
之前,在onCreate中初始化FacebookSdk
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Initialize FacebookSdk here
FacebookSdk.SdkInitialize (this.ApplicationContext);
setContentView(R.layout.activity_main);
}
有关facebook登录的更多信息,请在此处查看我的答案。 full fb login code