我在尝试在我的libgdx项目中添加Facebook登录功能时不断获得NoClassDefFoundError
。
java.lang.NoClassDefFoundError: com.facebook.LoggingBehavior[]
at com.facebook.FacebookSdk.<clinit>(FacebookSdk.java:63)
at com.example.app.android.AndroidLauncher.onCreate(AndroidLauncher.java:44)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
我在build.gradle中有。
compile "com.facebook.android:facebook-android-sdk:4.9.0"
从AndroidLauncher内部我可以引用此jar中的类
FacebookSdk.sdkInitialize(getApplicationContext());
callbackManager = CallbackManager.Factory.create();
甚至是假设缺失的那个,主要是LoggingBehavior
,并且仍然没有充分的理由在运行时该类不存在。