Android app card sharing not working



Hello, I want to share my application content on android. First i download picture, then I use your code from documentation, but I could not see app card image. After clicking on tweet, tweeting activity is closed with error:

Post Tweet failed Uri file path resolved to null

here’s my code:
final TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();
Uri uri = Uri.parse(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + “be_reporter_twitter_share.jpg”);
Log.d(“twitter”, uri.toString());
final Card card = new Card.AppCardBuilder(getActivity())
final Intent intent = new ComposerActivity.Builder(getActivity())


Hey @stefiix92,

Based on the error you posted, the URI isn’t returning a valid file path so I’d check the path that you’re logging out. From another post here, you can see some other solutions and test cases: Unity Fabric AppCard not rendering



This will not generate a valid Uri since the toString method of File doesn’t returns a Uri.

Uri uri = Uri.parse(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "be_reporter_twitter_share.jpg");

Try something like:

final File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "be_reporter_twitter_share.jpg");
final Uri uri = file.toURI();


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.