react-native-social-share: Android Error

I’ve an error while trying to share via Facebook or Twitter on an Android device (iOS ok):

captura de pantalla 2017-03-22 a las 16 53 34

_shareOnFacebook() { shareOnFacebook({ 'link':'https://artboost.com/' }, (results) => { console.log(results); } ); } Maybe I’ve skipped something in the documentation?

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

I got the same error on android emulator, I was unable to make shareOnTwitter to work.

I added an import : import com.barefootcoders.android.react.KDSocialShare.KDSocialShare; to the MainApplication.java and new KDSocialShare() in the getPackages method and finally got it working, but only the text field.

Not tested on device with the twitter app installed yet.

Hope these two lines will help !

@minhtule you got me on the right path, thank you! I was missing the line in build.gradle (and package.json was referring to 0.9.0 instead of 1.0). Once I added the link into build.gradle the package started building successfully on Android, but wouldn’t actually post anything (i’d just get an “error” as the result).

To get it to actually work, I needed to uninstall and reinstall specifically installing version 1.0.0. Once I installed, re-linked, checked all files were right, it actually worked (for twitter only, as expected)!

This did break iPhone from building, time to go try and figure out why fixing this broke iOS…

EDIT: For anyone else in the future who breaks their iOS instance this way. I realized my issue was from re-running Link after downloading 1.0.0. To fix this:

  • I created a new branch from Master (where it was compiling and working on iOS, compiling but not working on Android)
  • I made sure I had 1.0.0 installed
  • I manually checked/updated the 4 files outlined above by @minhtule

Once I followed those steps I got my app back compiling on both platforms and twitter working on both platforms.

yes I did but for some reason it didn’t work. Now I did a clean installation of the module and it seems to be working fine for Twitter, about Facebook isn’t working but no errors at all, I assume that is b/c I’m using the simulator and without the Facebook app installed! Thanks for your help @minhtule.