-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android Error #39
Comments
Hi @buskerone |
@Jberlinsky @minhtule can you help me guys? |
@buskerone I'm sorry that I'm not familiar with the share-via-Facebook feature. I would recommend you to use the official Facebook react native sdk. If you have a problem with share-via-Twitter, please share the stack trace here! |
Ok thanks @minhtule . I'll try with Facebook RN SDK. The problem is also with sharing via twitter (Android). Same error. |
@buskerone After installing the module ( |
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. |
@buskerone You're welcome! I'm glad that it's finally working for you! 😄 |
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 or @Jberlinsky I seem to be having the same issue as the people above. I have the module installed and working on IOS, no luck with Android yet. Things I've tried:
I've attached a picture of the error I get, along with the MainApplication file where you can see the 2 lines in there (these were added through the Link). If I remove the 2 lines from MainApplication I can get the app to compile, but when I try to tweet I get undefined is not an object (evaluating 'KDSocialShare.tweet') Any suggestions are very appreciated. Thanks! |
Here are the changes I had when installing this library.
And the 2 lines in MainApplication.java that Tigrakto mentioned. @angusmccloud Could you please check that you have all these changes? |
@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:
Once I followed those steps I got my app back compiling on both platforms and twitter working on both platforms. |
Let me know if I should add/edit something in the README.md or other files, keeping in mind it should work for all scenarios 😄 |
@doefler the only thing I would do is add to the website the steps of checking those 4 files as part of installation. It seems like running npm link takes care of 3 of the 4 - but checking all 4 can't hurt. OR, I suppose that can continue to live in this thread where anyone trying to get Android working will find it (aka how I got here). |
I think some of your advice from above could be combined into a step by step guide and video. |
this happen to me also. Is there a way to separate the share system of twitter and facebook? I just want to use the twitter and the facebook part is having an issue with the current rn fbsdk module, so its much better if you can separate it because when I install it, it crash the app also it duplicates all codes that I added for rn-fbsdk for android, And I need to uninstall this and manually remove all codes that this plugin install. thanks, |
Hey @eggybot I am not quite sure how you imagine it to work/be implemented. if (options.hasKey("text") && doesPackageExist("com.facebook.katana")) {
String shareText = options.getString("text");
shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, shareText);
} else if (options.hasKey("link")) {
String shareUrl = options.getString("link");
String sharerUrl = "https://www.facebook.com/sharer/sharer.php?u=" + shareUrl;
shareIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(sharerUrl));
} else {
if (options.hasKey("text") && !doesPackageExist("com.facebook.katana")) {
callback.invoke("error", "If text is provided to Facebook sharing, the application must be installed");
} else {
callback.invoke("error");
}
return;
} Would be awesome to find a sustainable fix for Android, so people don't get these issues :) |
image not loading in twitter share android and tweet button is also disable @minhtule can u help me fix i :) |
@nandhakishore14 I'm very sorry to disappoint you but I no longer do development on React Native so I'm not familiar with the latest changes on the platform to help you debug 😞 |
I've an error while trying to share via Facebook or Twitter on an Android device (iOS ok):
_shareOnFacebook() { shareOnFacebook({ 'link':'https://artboost.com/' }, (results) => { console.log(results); } ); }
Maybe I've skipped something in the documentation?
The text was updated successfully, but these errors were encountered: