0

当我的应用程序尝试登录 FB 时,我在“R.layout.com_facebook_login_activity_layout”上收到“NoClassDefFoundError”。

我的代码如下:

private void onClickLogin() {
    Session session = Session.getActiveSession();
    if (!session.isOpened() && !session.isClosed()) {
    final List<String> PERMISSIONS = Arrays.asList("publish_stream");
    OpenRequest openRequest=new Session.OpenRequest(this);
    openRequest.setPermissions(PERMISSIONS);
    openRequest.setCallback(statusCallback);
    openRequest.setDefaultAudience(SessionDefaultAudience.ONLY_ME);
    openRequest.setLoginBehavior(SessionLoginBehavior.SSO_WITH_FALLBACK);
    session.openForPublish(openRequest);
} else {
    Session.openActiveSession(this, true, statusCallback);
}

日志如下:

05-30 15:07:12.022: D/AndroidRuntime(18732): Shutting down VM
05-30 15:07:12.022: W/dalvikvm(18732): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0)
05-30 15:07:12.062: E/AndroidRuntime(18732): FATAL EXCEPTION: main
05-30 15:07:12.062: E/AndroidRuntime(18732): java.lang.NoClassDefFoundError: com.facebook.android.R$layout
05-30 15:07:12.062: E/AndroidRuntime(18732):    at com.facebook.LoginActivity.onCreate(LoginActivity.java:55)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1836)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1893)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at android.app.ActivityThread.access$1500(ActivityThread.java:135)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at android.os.Looper.loop(Looper.java:150)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at android.app.ActivityThread.main(ActivityThread.java:4385)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at java.lang.reflect.Method.invokeNative(Native Method)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at java.lang.reflect.Method.invoke(Method.java:507)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
05-30 15:07:12.062: E/AndroidRuntime(18732):    at dalvik.system.NativeStart.main(Native Method)
05-30 15:07:14.674: D/Process(18732): killProcess, pid=18732
05-30 15:07:14.724: D/Process(18732): dalvik.system.VMStack.getThreadStackTrace(Native Method)
05-30 15:07:14.724: D/Process(18732): java.lang.Thread.getStackTrace(Thread.java:745)
05-30 15:07:14.724: D/Process(18732): android.os.Process.killProcess(Process.java:797)
05-30 15:07:14.724: D/Process(18732): com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:108)
05-30 15:07:14.724: D/Process(18732): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:854)
05-30 15:07:14.724: D/Process(18732): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:851)
05-30 15:07:14.734: D/Process(18732): dalvik.system.NativeStart.main(Native Method)
    }

没有什么我能想到的。应用程序编译和链接很好。

任何想法?

谢谢你。

4

0 回答 0