后端 setWhereClause 数据查询 returns 致命异常错误

Backendless setWhereClause Data Query returns FATAL EXCEPTION error

我正在尝试将 Parse 项目迁移到 Backendless。 因此,我正在按照教程学习 Backendless。 该教程由 Samantha Squires 编写,位于 Youtube 上。 我在这里构建的是添加 2 个人为朋友的能力。 我以测试用户身份登录,我想将一个朋友添加到我的朋友列表中。 下面介绍在Backendless中添加2位好友的方法。 我收到以下错误消息:

E/AndroidRuntime: FATAL EXCEPTION: IntentService[AddFriendService]
                                                                                    java.lang.NoClassDefFoundError: java.util.Objects
                                                                                        at com.backendless.Persistence.find(Persistence.java:638)
                                                                                        at com.backendless.DataStoreFactory.find(DataStoreFactory.java:188)
                                                                                        at com.example.muhammadahsan.a27sam01.AddFriendService.addFriends(AddFriendService.java:121)
                                                                                        at com.example.muhammadahsan.a27sam01.AddFriendService.onHandleIntent(AddFriendService.java:90)
                                                                                        at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
                                                                                        at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                        at android.os.Looper.loop(Looper.java:137)
                                                                                        at android.os.HandlerThread.run(HandlerThread.java:61)

我加2人为好友的方法是:

private void addFriends (String firstUserName, String secondUserName){

        Log.i("addFriendsMethod: ", "addFriendsMethod is Running");

        DataQueryBuilder query = DataQueryBuilder.create();

        query.setWhereClause(String.format("name = '%s' or name = '%s'", firstUserName, secondUserName));

        Backendless.Persistence.of(BackendlessUser.class).find(query, new AsyncCallback<List<BackendlessUser>>() {
            @Override
            public void handleResponse(List<BackendlessUser> response) {

                Log.i("Query Response:" , response.toString());

                List<BackendlessUser> users = response;

                if (users.size() !=2){
                    broadcastAddFriendFailure();
                    //That means we have more that one users or one of users wasn't found

                } else {
                    BackendlessUser user1 = users.get(0);//First user
                    final BackendlessUser user2 = users.get(1);//Second user

                    //Update first user, adding second user as a friend.
                    updateFriendsList(user1,user2);
                    Backendless.UserService.update(user1, new AsyncCallback<BackendlessUser>() {
                        @Override
                        public void handleResponse(BackendlessUser user) {
                            //Now Update second user adding first user as a friend
                            updateFriendsList(user2, user);//user is the updated version of user1
                            Backendless.UserService.update(user2, new AsyncCallback<BackendlessUser>() {
                                @Override
                                public void handleResponse(BackendlessUser response) {
                                    broadcastAddFriendSuccess();
                                }

                                @Override
                                public void handleFault(BackendlessFault fault) {
                                    broadcastAddFriendFailure();
                                }
                            });
                        }

                        @Override
                        public void handleFault(BackendlessFault fault) {
                            broadcastAddFriendFailure();
                        }
                    });
                }

            }

            @Override
            public void handleFault(BackendlessFault fault) {

            }
        });

    }

我知道

有问题
Backendless.Persistence.of(BackendlessUser.class).find(query, new AsyncCallback<List<BackendlessUser>>()

因为我试图在日志中测试 whereclause 的输出。 任何帮助将不胜感激。

似乎要使用 Backendless SDK,您必须将 Android SDK 19+ 指定为最小。原因是 Objects class' 静态方法(显然是 Backendless SDK 使用).