I am building an app which requires facebook login and authentication.
I am following
https://developers.facebook.com/docs/android/getting-started#create-app
I got this error: when I hit the facebook login button:

Multiple posts say that this code should resolve the error
Key hash doesn't match while facebook login in 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 the simple facebook login for my app?
