I am creating an application that requires facebook login and authentication.
I follow
https://developers.facebook.com/docs/android/getting-started#create-app
I got this error: when I clicked the facebook login button:

Several posts say this code should fix the error
Cache hash does not match when logging into facebook on android
:
try { PackageInfo info = getPackageManager().getPackageInfo( "com.hitup.hitup", PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures) { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT)); } } catch (NameNotFoundException e) { } catch (NoSuchAlgorithmException e) { }
however, the toByteArray () method cannot be resolved!

How can I resolve this error and achieve a simple facebook login for my application?
java android facebook facebook-android-sdk
Rohit tigga
source share