Facebook link sharing fails for some image urls in android

387 views Asked by At

I am trying to share link on Facebook. I am using FacebookDialog class and ShareLinkContent class of latest(4.2) facebook sdk as shown in following guide. https://developers.facebook.com/docs/sharing/android

I am setting the image url in ShareLinkContent. It is not able to share some images while it successfully shares other images.

This is my logcat output for failed cases:

06-24 16:43:11.356  10101-10101/com.tws.android W/System.err﹕ Error  publishing message
06-24 16:43:11.392  10101-10101/com.tws.android W/System.err﹕ at com.facebook.internal.NativeProtocol.getExceptionFromErrorData(NativeProtocol.java:695)
06-24 16:43:11.392  10101-10101/com.tws.android W/System.err﹕ at com.facebook.share.internal.ShareInternalUtility.handleActivityResult(ShareInternalUtility.java:184)
06-24 16:43:11.392  10101-10101/com.tws.android W/System.err﹕ at com.facebook.share.internal.ShareInternalUtility$3.onActivityResult(ShareInternalUtility.java:276)
06-24 16:43:11.392  10101-10101/com.tws.android W/System.err﹕ at com.facebook.internal.CallbackManagerImpl.onActivityResult(CallbackManagerImpl.java:82)
06-24 16:43:11.392  10101-10101/com.tws.android W/System.err﹕ at com.tws.android.activities.WalletActivity.onActivityResult(WalletActivity.java:388)
06-24 16:43:11.392  10101-10101/com.tws.android W/System.err﹕ at android.app.Activity.dispatchActivityResult(Activity.java:6192)
06-24 16:43:11.392  10101-10101/com.tws.android W/System.err﹕ at android.app.ActivityThread.deliverResults(ActivityThread.java:3570)
06-24 16:43:11.392  10101-10101/com.tws.android W/System.err﹕ at android.app.ActivityThread.handleSendResult(ActivityThread.java:3617)
06-24 16:43:11.392  10101-10101/com.tws.android W/System.err﹕ at android.app.ActivityThread.access$1300(ActivityThread.java:151)
06-24 16:43:11.393  10101-10101/com.tws.android W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1352)
06-24 16:43:11.393  10101-10101/com.tws.android W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:102)
06-24 16:43:11.393  10101-10101/com.tws.android W/System.err﹕ at android.os.Looper.loop(Looper.java:135)
06-24 16:43:11.393  10101-10101/com.tws.android W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5254)
06-24 16:43:11.393  10101-10101/com.tws.android W/System.err﹕ at java.lang.reflect.Method.invoke(Native Method)
06-24 16:43:11.393  10101-10101/com.tws.android W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:372)
06-24 16:43:11.393  10101-10101/com.tws.android W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
06-24 16:43:11.393  10101-10101/com.tws.android W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
1

There are 1 answers

0
Greg On

For future reference, I stumbled upon the same problem and solved it by checking the following items :

  • Display Name in Facebook Dashboard under Settings has to match exactly your app_id in your strings.xml file
  • Google Play Package Name in Facebook Dashboard under Settings has to match exactly your project structure
  • Be sure that you have generated your Hashes correctly. In case you want to change your app id according to debug/release, you can put them in your gradle file like so : resValue "string", "facebook_app_id", "\"YOUR_APP_ID\"" and then get the reference in your manifest file like so : <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

In my case, I was working on a development branch so I appended in my gradle file a ".dev" at the end of my package structure which I did not put in the Facebook dashboard.