1

我正在尝试将媒体上传到 android 中的 twitter。我正在将此更新与 Media Api 一起使用。我正在使用以下代码

multiPartEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
    try
    {
        multiPartEntity.addPart("status", new StringBody("Metallica rules man! |m|"));
        multiPartEntity.addPart("media[]", new InputStreamBody(getResources().openRawResource(R.drawable.metallica), "metallica.jpg"));
        post = new HttpPost("https://api.twitter.com/1.1/statuses/update_with_media.json");
        post.setEntity(multiPartEntity);
        post.addHeader("Content-Type", "multipart/form-data");
        post.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
        consumer.sign(post);
        response = client.execute(post);
        entity = response.getEntity();
    } catch (Exception e1)
    {
        e1.printStackTrace();
    }

但我从 Twitter收到错误代码 131 - 内部错误。我也尝试以字节数组的形式发送图像,但徒劳无功。我得到了同样的错误。谁能帮我解决这个问题?

4

0 回答 0