First off I realize this question has been asked before and I have read those posts and searched the net and tried the examples but still get this error when running my app:
09-06 16:09:47.010: W/fb4a(:):BlueServiceQueue(3237): com.facebook.http.protocol.ApiException: remote_app_id does not match stored id
I can run the app from Eclipse and it works just fine. The problem I have is when I export the project to an APK and email it to a tester and they install it does not work. I am exporting it with my Play store keystore so I'm sure this has something to do with the hashkey but I just can't figure this out and would really appreciate any advice I can get.
I have generated the hashkey with the keytool using the same keystore and alias I exported the file as:
keytool.exe -exportcert -alias android_market -keystore E:\Droid Projects\keystore_market.keystore | C:\Java\openssl\bin\openssl sha1 -binary | C:\Java\openssl\bin\openssl base64
I read ALLOT of posts that said this sometimes gives the wrong hashkey so I also put this code in my onCreate to generate it in the logcat and also on the screen and then exported the apk again:
try {
PackageInfo info = getPackageManager().getPackageInfo(
"com.my.package.name",
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));
Toast.makeText(NoteFBHome.this, Base64.encodeToString(md.digest(), Base64.DEFAULT), Toast.LENGTH_LONG).show();
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
Before anyone asks I did put my actual package name in the code :) But this gives me the same key. I then noticed that the Facebook developer console said it could take a few minutes to hit all the servers but I have waited several hours now and still same error.
I read with the old Facebook SDK that you could modify the actual Facebook code to show the hashkey it was looking for but the code appears to be changed in ver 3.0.
I'm sure there is something I am missing but I guess I have looked at this so long I just can't see it. If anyone has any tricks that worked for them or other ideas to figure out why the hashkey is wrong I would appreciate it.
Solution:
Just wanted to give an update that I was able to fix this issue and provide any help for anyone with similar problems. The keytool gives a hashkey even if your string is wrong. In my case it was because I had the path of the keystore file incorrect. What finally made me realize this was another post indicating that I should be prompted with the keystore password but I never was. So for anyone else with this issue, if you are not prompted for the password you may have the keytool string incorrect. Hope this helps.
Solution:
Just wanted to give an update that I was able to fix this issue and provide any help for anyone with similar problems. The keytool gives a hashkey even if your string is wrong. In my case it was because I had the path of the keystore file incorrect. What finally made me realize this was another post indicating that I should be prompted with the keystore password but I never was. So for anyone else with this issue, if you are not prompted for the password you may have the keytool string incorrect. Hope this helps.