[Android SDK] My Facebook SDK code is not compiling anymore (error: cannot find symbol)

You may have a working Android App that integrates Facebook SDK. It may also be running in production (mine is). And after a few months, you try to recompile it and…

error: cannot find symbol

Referred to these (or maybe another) Facebook SDK classes.

com.facebook.Session;
com.facebook.SessionState;
com.facebook.Settings;
com.facebook.UiLifecycleHelper;
com.facebook.widget.FacebookDialog;

The reason: Your Facebook SDK version is too new.
Open your build.gradle file, and try changing

compile 'com.facebook.android:facebook-android-sdk:+’

for

compile 'com.facebook.android:facebook-android-sdk:3.+'

In the Facebook SDK official documentation, they encourage you to include a dependency to the latest version (4.0.0, or ‘+’, or similar), and your code was probably written for 3.X.

This issue gave me a headache diving into the code, and was as silly as that 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s