Apollo-android: Cannot find generated code using apollo in android studio kotlin

Created on 30 Aug 2020  路  9Comments  路  Source: apollographql/apollo-android

Question.
Hai, currently i'm using apollo plugin version 2.3.0, and also try using version 2.3.1 same as this guide : https://www.apollographql.com/docs/android/essentials/get-started-multiplatform/ but i still cannot find auto generate code for used as the same graphql name. also i already place the graphql same level with the java, is that any step that i missing ?

Screen Shot 2020-08-30 at 15 45 38

Question

All 9 comments

Hi 馃憢
After you build your project, the generated files will be in build/generated/source/apollo/

Hi 馃憢 @martinbonnin
i already check the directory where the code is generated but it's not there just like this :
Screen Shot 2020-08-31 at 02 49 47

Can you share the contents of morthie.graphql ?

Something else you can try is build with --no-build-cache: ./gradlew generateApolloSources --no-build-cache to make sure this isn't a build cache issue.

Here is the content of mothie.graphql :
Screen Shot 2020-08-31 at 11 28 21

Apollo doesn't support unnamed queries, you should give a name to your query like query GetCharacters . I suspect there's something else going on though because it should give an error. Can you try with a named query and let me know if it works any better?

Ok i already add name to query and i already get the class just like this :
Screen Shot 2020-09-01 at 21 52 30
Screen Shot 2020-09-01 at 21 52 21

the class name is AnimationQuery is that correct in that path ? but i can't use it. Or should i rebuild again for the project ?

AnimationQuery sounds good 馃憤

You should be able to call it like this:

apolloClient.query(AnimationQuery())

Then I would recommend using the coroutines extensions:

val response = apolloClient.query(AnimationQuery())toDeferred().await()

i see now i can use the AnimationQuery. Ok i will try use coroutines for access thanks for the support 馃憤

Sounds good 馃憤 . I'm closing this issue, let me know if you want to reopen it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TayfunCesur picture TayfunCesur  路  4Comments

AOrobator picture AOrobator  路  3Comments

rnitame picture rnitame  路  3Comments

RageshAntony picture RageshAntony  路  3Comments

john-lanticse picture john-lanticse  路  3Comments