Android Facebook SDK 3.0 gives "remote_app_id does not match stored id" while logging in

David Fang picture David Fang · Dec 15, 2012 · Viewed 30.4k times · Source

I'm trying to build a app that uses Facebook SDK for Android 3.0. But when I'm trying to call

Session.openActiveSession

It just simply gives me a SessionState with CLOSED_LOGIN_FAILED, and LogCat is:

12-16 00:03:40.510: W/fb4a:fb:OrcaServiceQueue(4105): com.facebook.orca.protocol.base.ApiException: remote_app_id does not match stored id 

I have searched StackOverflow with "remote_app_id" and the results are the "Bundle ID" in iOS, but I don't know what does the "remote_app_id" means in Android. I have already set the package name and the activity name in my Facebook app settings. I have no idea of the reason of the error.

Answer

JPMagalhaes picture JPMagalhaes · Dec 26, 2012

Another possible error (which happened with me) is: to set up a "Key Hash" at Facebook App Console and to sign the android app using another keystore.

Unfortunately this is caused because Facebook Getting Started Tutorial induces this error. It says that android developers should use default android debug key in your examples and doesn't explain that the Key Hash should be generated with the same keystore you will sign your application.

My recomendation is to set up two Key Hashes at your facebook console:

  1. default android debug key:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

  1. your application release key:

keytool -exportcert -alias yourappreleasekeyalias -keystore ~/.your/path/release.keystore | openssl sha1 -binary | openssl base64

Remember: you cannot publish an application that is signed with the debug key generated by the SDK tools. So it isn't possible to publish an app using only the hash key generated using the first previous command line (as facebook tutorial suggests.

For more information about signing your application, visit Signing Your Application.