Facebook Android SDK FAQ & Troubleshooting

FAQ

You can use one Facebook app ID in multiple Android apps. Just use the same app ID in another app for login, sharing, and so on.

For deep linking and opening your app through notifications and other means, we only support a single package name/class name combination.

If you want multi-app support for deep linking, see App Links.

You can override strings in the Facebook SDK for Android can by providing a translation in your own strings.xml file for the desired locale.

The strings.xml file in the facebook/res/values/ directory contains all the strings that the SDK uses. The name of the string resources should be self-explanatory.

For more information, see Android Developer's Guide: Localizing with Resources.

You can download earlier versions of the SDK at SDK downloads.

Every release of the Facebook SDK for Android with the native Share dialog also includes an APK for the Facebook app.

This APK was in the SDK download until release 3.14.1. After this time it became a separate download. You can find the APKs on our Downloads page.

Simply install the Facebook APK on your Android emulator or device and test the native Share dialog from your app.

Normally, Android libraries can use BuildConfig.DEBUG to determine if the app is in debug mode. However, due to a bug in Gradle, Android libraries are always built with DEBUG set to false. As a workaround, there is a FacebookSdk.setIsDebugEnabled(boolean) method so you can directly set the debug mode from your app. This enables debug logging from the SDK.

You can also set logging behaviors with FacebookSdk.addLoggingBehavior(LogginBehavior) to enable logging for different categories of messages. See the Android SDK Reference, LoggingBehavior.

The Share dialog makes callbacks into onSuccess and onCancel upon a user action.

  • onSuccess when the user successfully shares. Furthermore, there will also be a postId in the Sharer.Result class if the user gave the app publish_actions permissions. If that user has not logged in with Facebook Login, this method will also be called if the user clicks Cancel.
  • onCancel when someone clicks Share dialog's X button or if they have logged in with Facebook Login and clicked Cancel.

The following features in the Facebook SDK for Android are not supported on Android Gingerbread, API Levels 9 and 10:

  • JavaScript dialog
  • Android Page Like and Page Like box
  • App Invites

Troubleshooting

When you request publish permissions, you may get the error:

  • "Session: an attempt was made to request new permissions for a session that has a pending request" or
  • "Attempted to authorize while a request is pending"

This error message means that your app is trying to request new permissions before the previous request completed. All requests for permissions are asynchronous and you can't request new permissions until the previous request completes.

See our sample apps provided with the SDK such as Scrumptious or Hello Facebook to see how to ask for new permissions in multiple steps.

If there are no errors in the logs the likely cause is that the request was never executed. To execute the GraphRequest, call the executeAsync method.

To login or use the native Share dialogs, you need to tell Facebook about the key that you use to sign your apps.

This is a key hash which is a SHA-1 hash of the key used to sign your app. Usually there will be at least two different keys used, one for development and debug, and one for release. Verify that both values have been added in your app's settings page.

For more information, see Getting Started Android SDK - Create a Development Key Hash.

The most common cause is that you didn't set up a ContentProvider in your AndroidManifest.xml. Make sure you add it to your AndroidManifest.xml file with your app ID. See Sharing on Android - Prerequisites.