黑莓的Facebook SDK引发异常:出现NoClassDefFoundError [英] Blackberry Facebook SDK throwing exception: NoClassDefFoundError

查看:227
本文介绍了黑莓的Facebook SDK引发异常:出现NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了所有有关我的问题的主题搜查,但找不到解决的办法。
我编码使用BlackBerry Java插件用于Eclipse V1.5.2与JRE 7.1.0黑莓应用程序。我目前正试图以Facebook连接集成到我的应用程序,使用户可以登录到通过Facebook我们的应用程序。
我使用黑莓的Facebook SDK是从这里下载的版本0.8.25:

I've searched through all the topics related to my question but couldn't find a solution to it. I'm coding for a Blackberry app using the BlackBerry Java Plug-in for Eclipse v1.5.2 with JRE 7.1.0. I'm currently trying to integrate Facebook Connect into my app so that the users can log into our app through Facebook. The Blackberry Facebook SDK that I'm using is version 0.8.25 downloaded from here:

http://sourceforge.net/projects/facebook-bb-sdk/

要使两个jar文件,FacebookBlackberrySDK-v0.8.25.jar和Log4B-v0.9.4.jar我第一次$ P $与Eclipse pverified他们成功和其纳入我的项目图书馆后。
该项目成功编译但后来我得到了一个运行时错误:的NoClassDefFoundError
经过调试,我发现,这个例外是在这行抛出:

After getting the two jar files, FacebookBlackberrySDK-v0.8.25.jar and Log4B-v0.9.4.jar I first preverified them with eclipse successfully and included them into my project as libraries. The project compiled successfully but then I got a run time error: NoClassDefFoundError. After debugging, I found out that the exception was thrown at this line:

fb = Facebook.getInstance(new ApplicationSettings(NEXT_URL, APPLICATION_ID, APPLICATION_SECRET, Facebook.Permissions.ALL_PERMISSIONS));

和我怀疑的程序无法找到文件Facebook.class
下面是我的源$ C ​​$ C:

and I suspect that the program couldn't find the file Facebook.class below is my source code:

package com.nextmobile.ecourage.net;

import com.blackberry.facebook.ApplicationSettings;
import com.blackberry.facebook.Facebook;

public class FacebookLogin
{
    private final String NEXT_URL = "http://www.facebook.com/connect/login_success.html";
    private final String APPLICATION_ID = "153555168010272";
    private final String APPLICATION_SECRET = "354f91a79c8fe5a8de9d65b55ef9aa1b";
    private Facebook fb;
    private Facebook fb4u;

    public FacebookLogin()
    {
        fb = Facebook.getInstance(new ApplicationSettings(NEXT_URL, APPLICATION_ID, APPLICATION_SECRET, Facebook.Permissions.ALL_PERMISSIONS));
        fb4u = Facebook.getInstance(new ApplicationSettings(NEXT_URL, APPLICATION_ID, APPLICATION_SECRET, Facebook.Permissions.USER_DATA_PERMISSIONS));
        fb4u.addPermission(Facebook.Permissions.OFFLINE_ACCESS);
    }
}

所以我代替这些行仅此行code的:

So I replaced those lines with only this line of code:

new ApplicationSettings(NEXT_URL, APPLICATION_ID, APPLICATION_SECRET, Facebook.Permissions.ALL_PERMISSIONS);

和它的工作没有给予任何错误。
这很奇怪的原因既Facebook.class和ApplicationSettings.class在同一个目录中,该程序能找到ApplicationSettings.class但不Facebook.class。

and it worked without giving any error. It's weird cause both Facebook.class and ApplicationSettings.class were in the same directory and the program could find ApplicationSettings.class but not Facebook.class.

这两个类都包下: com.blackberry.facebook

有没有人对此有什么想法?谢谢!

Does anyone have any idea on this? Thank you!

推荐答案

可能原因的applicationSettings编译具有较高的Java版本。
请检查您的项目属性 - > Java的反编译>编译器遵从性级别 - >这必须是1.4

Possible reason ApplicationSettings is compiled with higher java version. Check your project properties->java compiler->compiler compliance level -> this must be 1.4

这篇关于黑莓的Facebook SDK引发异常:出现NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆