
This is my code to fetch data for a particular Attribute-
try {
lifecycleScope.launch {
val getData = databases.getDocument(
databaseId = "669...49",
collectionId = "669...15d6",
documentId = "669...2f5b",
queries = listOf(Query.select(listOf("PrescriptionFileId")))
)
Log.d("GetFilesLog", "Result: ${getData}")
}
catch (e : Exception){
Log.d("GetFilesLog", "Exception: $e")
}```
Here is the Exception -
FATAL EXCEPTION: OkHttp Dispatcher (Ask Gemini) Process: com.geekster.getfilesfromdevice, PID: 29680 java.lang.NullPointerException: null cannot be cast to non-null type kotlin.String at io.appwrite.models.Document$Companion.from(Document.kt:89) at io.appwrite.services.Databases$getDocument$converter$1.invoke(Databases.kt:190) at io.appwrite.services.Databases$getDocument$converter$1.invoke(Databases.kt:188) at io.appwrite.Client$awaitResponse$2$1.onResponse(Client.kt:541) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:545) 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)```
Even though I'm finally able to get the required data from the Attribute by getting the response without the query and converting the response to Json and then to Gson and then getting the required data. But I wanted to know is there any issue with my codebase or the query isn't working for Android SDK. I've tried using other queries, few of them work as expected but other ones throw some errors.
Recommended threads
- Flutter OAuth2 Google Login – Redirect I...
i tried implementing OAuth2 Google Login in my app, and it works fine for the most part, the problem am facing is when i chose a google account to sign in/up wi...
- Cannot use Google Oauth in my Project
I tried to use Appwrite Google Oauth Provider in my app but had some troubles. I receives this error no matter what: error or success: 2025-09-21 18:50:33.845 3...
- Adding "name" column to table creates 2-...
As stated, im adding the "name" column to one table, it adds 4 duplicates. In another table it adds 3 duplicates, and when I delete 1 of them, all duplucates di...
