【发布时间】:2013-05-20 11:38:27
【问题描述】:
我正在尝试非常简单地测试 3.0 Facebook 入门指南。 https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/
我在导入和引用方面遇到了一些问题,但我不知道这是否相关。我遇到的问题是当我尝试运行测试 Activity ant 时出现此错误:
Could not find class 'com.test1.test2.FacebookLogin$1', referenced from method com.test1.test2.FacebookLogin.onCreate
代码:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_facebook_login);
//Error occurs here when I use 'this'
Session.openActiveSession(this, true, new Session.StatusCallback() {
// callback when session changes state
@Override
public void call(Session session, SessionState state, Exception exception) {
if (session.isOpened()) {
// make request to the /me API
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
// callback after Graph API response with user object
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
TextView welcome = (TextView) findViewById(R.id.welcome);
welcome.setText("Hello " + user.getName() + "!");
}
}
});
}
}
});
}
当我使用this 时,如何获得NoClassDefFoundError?
更新:
在使用 Scrumtious 教程 https://developers.facebook.com/docs/tutorials/androidsdk/3.0/scrumptious/authenticate/ 进行测试后,我在调用 Session.StatusCallback() 方法时也遇到了同样的错误。我仍然不知道我的问题是什么。
感谢您的帮助
【问题讨论】:
-
您似乎也在使用
super而不仅仅是this -
@ZouZou 谢谢,但我没有
-
FacebookLogin$1 表示它是 facebooklogin 中的匿名类,也许是 Session.StatusCallback?它是 facebook api 的一部分吗?你会把它上传到你的安卓设备吗?
-
@user902383 是的,这似乎是一些问题。我现在尝试使用 Scrumptious 测试应用程序并在调用 new Session.StatusCallback() 时遇到相同的错误,您是否知道它可能是什么,是的,我将它上传到我的设备。谢谢
标签: java android facebook reference noclassdeffounderror