Back

NullPointerException occurring when calling account.createEmailPasswordSession()

  • 0
  • Android
  • Auth
  • Cloud
rockdish
30 Mar, 2024, 14:37

Android SDK version 5.0.0 Creating session with by email and password gives NullPointerException

FATAL EXCEPTION: OkHttp Dispatcher Process: com.anshtya.myhub, PID: 13693 java.lang.NullPointerException: null cannot be cast to non-null type kotlin.collections.List<kotlin.Any> at io.appwrite.models.Session$Companion.from(Session.kt:241) at io.appwrite.services.Account$createEmailPasswordSession$converter$1.invoke(Account.kt:1155) at io.appwrite.services.Account$createEmailPasswordSession$converter$1.invoke(Account.kt:1153) at io.appwrite.Client$awaitResponse$2$1.onResponse(Client.kt:541) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012)

Session.kt:241 https://github.com/appwrite/sdk-for-android/blob/482657237936b30a550f8ed6916ca63753483b03/library/src/main/java/io/appwrite/models/Session.kt#L241

In SDK version 4.0.0 session got created without any errors.

TL;DR
NullPointerException occurs when calling account.createEmailPasswordSession() in Android SDK version 5.0.0. It seems to be related to a casting issue in the code. The error is not present in SDK version 4.0.0. Solution: This issue is likely due to a bug in the code for Session.kt. You may want to check for any recent changes in that file that might have caused the problem.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more