所以我正在尝试使用Java-Binding的 Xamarin Facebook Simple 示例。
面对最初的问题,我必须下载并编译最新的 Facebook for Android SDK(使用 Eclipse)并将其压缩为 Facebook java-bindings 项目。
但是,当单击注销按钮时,我收到此错误:
Java.Lang.NoSuchFieldError: com.facebook.android.R$drawable.close
at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue[]) [0x00023] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.4-branch/74c352d0/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:368
at Com.Facebook.Android.Facebook.Authorize (Android.App.Activity,string[],Com.Facebook.Android.Facebook/IDialogListener) <IL 0x00095, 0x002af>
at Com.Facebook.Android.LoginButton/ButtonOnClickListener.OnClick (Android.Views.View) [0x00051] in C:\Users\magnus\Downloads\xamarin-monodroid-samples-7e2c105\xamarin-monodroid-samples-7e2c105\Facebook\samples\simple\simple\Example.cs:140
at Android.Views.View/IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.4-branch/74c352d0/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.Views.View.cs:600
at (wrapper dynamic-method) object.9681ec74-91e4-4ca3-93b5-489e6e022fb2 (intptr,intptr,intptr) <IL 0x00012, 0x0001b>
--- End of managed exception stack trace ---
java.lang.NoSuchFieldError: com.facebook.android.R$drawable.close
at com.facebook.android.FbDialog.createCrossImage(FbDialog.java:106)
at com.facebook.android.FbDialog.onCreate(FbDialog.java:81)
at android.app.Dialog.dispatchOnCreate(Dialog.java:307)
at android.app.Dialog.show(Dialog.java:225)
at com.facebook.android.Facebook.dialog(Facebook.java:814)
at com.facebook.android.Facebook.startDialogAuth(Facebook.java:343)
at com.facebook.android.Facebook.authorize(Facebook.java:206)
at com.facebook.android.Facebook.authorize(Facebook.java:125)
at com.facebook.android.LoginButton_ButtonOnClickListener.n_onClick(Native Method)
at com.facebook.android.LoginButton_ButtonOnClickListener.onClick(LoginButton_ButtonOnClickListener.java:36)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9080)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
在 Eclipse Java 项目中使用完全相同的 JAR 就可以了。
似乎该R$drawable.close
资源丢失了,但它存在于 Zip 文件中。有什么想法可能是错的吗?