未知模式字符 'X' 从 Android 连接到 IBM Watson 对话 API 时发生异常

Unknown pattern character 'X' Exception occurs connecting to IBM Watson conversation API from Android

我正在 Android 上使用一些聊天机器人应用程序。之前一切都很完美。但是之前运行的同一个应用程序现在显示错误。 "Unknown pattern character 'X' "。不知道我做错了什么。我尝试了很多方法来查找错误,但都失败了。我在这里附上我的代码..

package com.example.rove2.conversation;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.ibm.watson.developer_cloud.conversation.v1.ConversationService;
import com.ibm.watson.developer_cloud.conversation.v1.model.MessageRequest;
import com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class MainActivity extends AppCompatActivity {
String conversation_username;
String  conversation_password;
String workspace_id;
Button sendbtn,clearbtn,jsonbtn;
EditText input,json;
String JsonString="";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    conversation_username = "c9d2fd27-0868-4e56-b3ae-66b76d2b52b4";
    conversation_password = "DYLntDWRvf12";
    workspace_id="cbb7fc4d-c216-4a81-ae70-445d6fa9dab9";
    sendbtn=(Button)findViewById(R.id.button);
    clearbtn=(Button)findViewById(R.id.button2);
    input = (EditText)findViewById(R.id.editText);
    json =(EditText)findViewById(R.id.editText2);
    jsonbtn=(Button)findViewById(R.id.button3);
}
String sendtoWatson(String message)
{
    ConversationService service = new 
ConversationService(ConversationService.VERSION_DATE_2017_02_03);
    service.setUsernameAndPassword(conversation_username, 
conversation_password);
    MessageRequest newMessage = new 
MessageRequest.Builder().inputText(message).build();
    MessageResponse response = service.message(workspace_id, 
newMessage).execute();
    String tx = response.toString();
    return  tx;
}
public void send(View view){
    Thread t=new Thread(){
        public void run() {
            String text = input.getText().toString();
            final String result = sendtoWatson(text);
            JsonString = result;
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    try{
                        JSONObject reader = new JSONObject(result);
                        JSONObject output = reader.getJSONObject("output");
                        JSONArray Intent = output.getJSONArray("text");
                        String speechTxt=Intent.getString(0);
                        json.setText(speechTxt);

                    }
                    catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            });
        }};
    t.start();
}
public void clearbutn(View view){
    input.setText("");
    json.setText("");
}
public void jsonbtn(View view){
    json.setText(JsonString);
}
}

错误发生在

MessageResponse response=service.message(workspace_id,newMessage).execute();

我可以在这里找到类似问题的答案 但是我无法理解我的 android 工作室版本是 2.1.2 和 JDK 版本是 8 的解决方案。请帮助...

这是一个已修复但尚未发布给 Maven 的已知问题。如果您查看存储库中的 README,其中有关于如何在我们等待 3.8.1.

期间使用快照发布的说明