Backendless 中 'Internal client exception' 的原因是什么?

What is the reason of 'Internal client exception' in Backendless?

我有table任务: enter image description here

我想在这个 table 中获取记录。但是有一个BackendlessException { code: 'Internal client exception', message: 'null' }

这是我的代码:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_task);

    Backendless.initApp(getApplicationContext() ,APP_ID, SECRET_KEY, VERSION);


    BackendlessCollection<Task> tasks = Backendless.Data.of(Task.class).find();

    System.out.println( "Size " + tasks.getCurrentPage().size() );


    Iterator<Task> iterator = tasks.getCurrentPage().iterator();

    while (iterator.hasNext())
    {
        Task t = iterator.next();
        System.out.println("Question = " + t.getQuestion());
        System.out.println("Answer =  " + t.getAnswer());
    }





}

Task.class:

   public class Task {
    public String Question ;
    public  String Answer ;
    public  String ownerId ;
    public    String objectId ;
    public   Date created ;
    public Date updated ;
    public Task()
    {

    }
    public Task(String Question ,String Answer)
    {
        this.Question = Question ;
        this.Answer = Answer ;

    }




}

我从 Backendless 文档中了解到这个查询。这个错误的原因是什么?如何避免这个错误?在从 Backedless 检索数据之前是否需要了解一些规则?

您正在此处的 UI 主线程上调用同步(阻塞)API:

BackendlessCollection<Task> tasks = Backendless.Data.of(Task.class).find();

为避免错误,要么创建一个单独的线程并在其中使用 API,要么将调用更改为异步版本。

API documentation 说:

Android applications cannot use synchronous APIs on the main UI thread. The reason for this is the main thread does not allow blocking calls. Since the API requests perform network-based communication, the naturally block. As a result, when using the Backendless APIs make sure to use the asynchronous version of the methods, or create a new thread and use the synchronous API in it