Search code examples
javaandroidfacebookfacebook-sdk-3.0

FacebookLogin: my android applicationId is null


I try to click the FacebookSDK login button and get an error

that my applicaitonId is null.

how can I init it properly?

            Session currentSession = sessionTracker.getSession();
            if (currentSession == null || currentSession.getState().isClosed()) {
                sessionTracker.setSession(null);
                Session session = new Session.Builder(context).setApplicationId(applicationId).build();
                Session.setActiveSession(session);
                currentSession = session;
            }

Solution

  • Include below line of code in you manifest.xml

    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>
    

    and

    <string name="app_id">Your Facebook App Id</string>
    

    in res/values/strings.xml