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
-
SocketException : Failed host lookup : ‘...
I recently got this exception on execution of my app, I’ m using Android x Flutter environment with internet permission and all what i know, I’m really stuck ...
-
Data is not displayed on actual applicat...
I have added the necessary files pertaining to the issue. I'm actually fetching a video object from backend and exhibit on front end . But data related to video...
-
Unable to post Images on Appwrite.
Hi I am unable to post Image on my appwrite storage. I am using React-Native please review my code export const uploadImageToAppwrite = async (urin) => {