Hi,
I’ve just integrated twitter with my Android app, and the login works fine. However I’ve a problem with sending a tweet.
Code is
Uri myImageUri = Uri.parse("file:///android_asset/twitterimg.jpg");
final Card card = new Card.AppCardBuilder(this)
.imageUri(myImageUri)
.googlePlayId("com.example.mygame")
.build();
final TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();
final Intent intent = new ComposerActivity.Builder(this)
.session(session)
.card(card)
.createIntent();
startActivity(intent);
When the tweet is sent it gets the error ‘com.twitter.sdk.android.core.TwitterApiException: /android_asset/twitterimg.jpg (No such file or directory)’ - however the image is shown in the app when they enter their tweet text, so it’s definitely exists on the device in the right place, and I presume specified ok in the intent. Last thing I tried was making sure the image was the right size (with preferred aspect ratio) as described in https://docs.fabric.io/android/twitter/compose-tweets.html but no change.
Exception is:
11-02 17:16:05.805: E/TweetUploadService(4237): Post Tweet failed
11-02 17:16:05.805: E/TweetUploadService(4237): com.twitter.sdk.android.core.TwitterApiException: /android_asset/twitterimg.jpg (No such file or directory)
11-02 17:16:05.805: E/TweetUploadService(4237): at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:390)
11-02 17:16:05.805: E/TweetUploadService(4237): at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
11-02 17:16:05.805: E/TweetUploadService(4237): at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
11-02 17:16:05.805: E/TweetUploadService(4237): at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
11-02 17:16:05.805: E/TweetUploadService(4237): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:444)
11-02 17:16:05.805: E/TweetUploadService(4237): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
11-02 17:16:05.805: E/TweetUploadService(4237): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
11-02 17:16:05.805: E/TweetUploadService(4237): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
11-02 17:16:05.805: E/TweetUploadService(4237): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
11-02 17:16:05.805: E/TweetUploadService(4237): at java.lang.Thread.run(Thread.java:1027)