AbstractMethod Error

I am trying to do a basic query with generated model classes and i get the below AbstractMethod Error. Kindly help

val apolloClient = ApolloClient.Builder().serverUrl("http://server-url").build();

val myData = apolloClient.query(GetInfoForCustomerQuery(custId = "xyz")).execute()

Error

Exception in thread “main” java.lang.AbstractMethodError: Receiver class com.mycompany.model.GetInfoForCustomerQuery does not define or inherit an implementation of the resolved method ‘abstract void serializeVariables(com.apollographql.apollo3.api.json.JsonWriter, com.apollographql.apollo3.api.CustomScalarAdapters, boolean)’ of interface com.apollographql.apollo3.api.Operation.
at com.apollographql.apollo3.api.http.DefaultHttpRequestComposer$Companion.composePostParams(DefaultHttpRequestComposer.kt:126)
at com.apollographql.apollo3.api.http.DefaultHttpRequestComposer$Companion.access$composePostParams(DefaultHttpRequestComposer.kt:77)
at com.apollographql.apollo3.api.http.DefaultHttpRequestComposer$Companion.buildPostBody(DefaultHttpRequestComposer.kt:225)
at com.apollographql.apollo3.api.http.DefaultHttpRequestComposer.compose(DefaultHttpRequestComposer.kt:71)
at com.apollographql.apollo3.network.http.HttpNetworkTransport.execute(HttpNetworkTransport.kt:50)
at com.apollographql.apollo3.interceptor.NetworkInterceptor.intercept(NetworkInterceptor.kt:22)
at com.apollographql.apollo3.interceptor.DefaultInterceptorChain.proceed(ApolloInterceptor.kt:23)
at com.apollographql.apollo3.ApolloClient.executeAsFlow$apollo_runtime(ApolloClient.kt:164)
at com.apollographql.apollo3.ApolloCall.toFlow(ApolloCall.kt:137)
at com.apollographql.apollo3.ApolloCall.execute(ApolloCall.kt:149)
at MainKt.main(Main.kt:15)
at MainKt$main$2.invoke(Main.kt)
at MainKt$main$2.invoke(Main.kt)
at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:270)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
at MainKt.main(Main.kt)

Hey there, I think this needs to be tagged kotlin - over here in the web tag we can only help you with the JavaScript client :slight_smile:

Thank you. It was a dependency issue in my build.gradle.kts
After correcting the dependencies, the issue was gone.

Hi Vinodjayachandran,

can you share the dependencies and what dependency issue caused you the error. I am also facing the same issue