Hi, I am trying to login/register with BE Android SDK, but have some problems.
When I am trying to call login or register methods async, I am getting at SDK UserService in callback methodhandleResponse(User response) response as null. And then app crashes with
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.backendless.BackendlessUser.setPassword(java.lang.String)' on a null object reference
at com.backendless.UserService$1.handleResponse(UserService.java:108)
at com.backendless.UserService$1.handleResponse(UserService.java:104)
at com.backendless.async.message.AsyncMessage$ResponseHandler.handle(AsyncMessage.java:64)
at com.backendless.async.message.AsyncMessage.handleCallback(AsyncMessage.java:41)
at com.backendless.core.AndroidCarrier$1.handleMessage(AndroidCarrier.java:37)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5977)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:940)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:801)
User creation:
BackendlessUser backendlessUser = new BackendlessUser();
backendlessUser.setEmail(email);
backendlessUser.setPassword(password);
backendlessUser.setProperty("name", name);
Permission for INTERNET exists.
SDK initialization:
The code you shared for user creation does not seem to be able to cause the exception (by looking at the stack trace). Have you tried running the program in a debugger to see where exactly the exception occurs?
Hi Mark, yes, crash happens in method handleResponse in SDK class UserService, because response comes there as a null. So it does not go to fault method, it goes with success, but with null response. I also should say that I am wrapping this call in rxJava, but don’t think that problem is in it.
Hi Mark, yes, crash happens in method handleResponse in SDK class UserService, because response comes there as a null. So it does not go to fault method, it goes with success, but with null response. I also should say that I am wrapping this call in rxJava, but don’t think that problem is in it.
I tried without any RxJava, just with async callback, and still nullpointer in internal UserService class, because onResponse null. I am pretty sure problem is that I init smth wrong or smth like that, but I have no idea what.
Finally, problem was in DASH("-") in keys, I don’t know how, but they wasn’t there after I copied keys. I am so sorry for disturbing you. Have a great day!