1.Install the Facebook app on your emulator
Steps:-
- If you're developing using an emulator, you may download Facebook's Android app as an APK and install it on your development environment.
- Install APK File
Make sure you have the emulator already running.
- Extract the contents of the zip to a folder.
- Find the APK file in the extracted folder, in the bin folder and rename it to a simple facebook.apkfile name. Copy this file.
- Browse to your SDK location on your computer and navigate to the platform-tools folder. (We need the adb here). Paste the facebook.apk file here
- In an empty area in the folder, with the Shift key pressed, right click and select Open command Window here (make sure you are not doing this on any file or folder).
- Now, at the command prompt, type this command: adb install facebook.apk
Following the above steps will install the Facebook application on your emulator.
2. Generating App Signature for Facebook Settings
To create facebook android native app you need to provide your Android application signature in facebook app settings. You can generate your application signature (keyhash) using keytool that comes with java. But to generate signature you need openssl installed on your pc. If you don’t have one download openssl and set it in your system environment path.
Open your command prompt (CMD) and run the following command to generate your keyhash. While generating hashkey it should ask you password. Give password as android. If it don’t ask for password your keystore path is incorrect.
Execute code: keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Ravi\.android\debug.keystore" | openssl sha1 -binary | openssl base64
if you get error :-
'keytool' is not recognized as an internal or external command, operable program or batch file.
OR
'openssl' is not recognized as an internal or external command, operable program or batch file.
Check that the directory the keytool executable is in is on your path if not give it on your pc path.
my computer>>rightClick>>properties>>Advanced system settings>>environment variables>> find path in system variables>>dbl click>> paste the "C:\Program Files\Java\jdk1.6.0_16\bin">>OK
same for openssl.
Further things are easy.. :)
Follow: http://www.androidhive.info/2012/03/android-facebook-connect-tutorial/