android
android

Reputation: 386

Facebook integration problem in android

I'm trying to integrate Facebook in my application.I've downloaded facebook sdk in my application and have added it in my project.But when i run my app i'm getting java.lang.noclassdeffounderror com.facebook.android. facebookthis exception on following line

Facebook facebook=new Facebook(App_id);

can somebody tell me where i'm going wrong....

Upvotes: 0

Views: 257

Answers (4)

Mohit Verma
Mohit Verma

Reputation: 3025

In the APP_Id you have to insert your own application id of the application that you created on Facebook. First you will have to create an application on Facebook, where you get the APP_ID and then use it.

Upvotes: 1

aleks
aleks

Reputation: 106

There are few tricks that should be done before successfully connect to Facebook. You have to obtain your application hash code using the key tool app. But the key tool can return wrong hash code. You have to install OpenSSl and this is a bit difficult.

I week ago I view this video on You Tube.

This is a video how to setup this application that can be bought from CodeCanyon. The author connect with facebook in No time. I bought the app and I had my running facebook application in 5 min.

Upvotes: 0

Bart Blommaerts
Bart Blommaerts

Reputation: 821

The Facebook library can not be found at runtime.

In Eclipse, you can add it, via "project" > properties > Android. In the 'library' Window, click add and select your Facebook library project.

A clean build should be enough to make the NCDFE go away.

Upvotes: 0

Bogdan M.
Bogdan M.

Reputation: 1726

for example i have a facebook instance and than you authorize it:

        mFacebook = app.getFacebookInstance();
    if (!mFacebook.isSessionValid()) {
        mFacebook.authorize(this, new String[] { "friends_birthday", "friends_about_me", "read_friendlists" }, new DialogListener() {

            @Override
            public void onFacebookError(FacebookError arg0) {

            }

            @Override
            public void onError(DialogError arg0) {

            }

            @Override
            public void onComplete(Bundle arg0) {

                getFriendsList();
            }

            @Override
            public void onCancel() {

            }
        });
    } else {
        getFriendsList();
        Log.i(LOG_TAG, "session valid");
    }
}

Upvotes: 0

Related Questions