Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apollo Android Client - Cannot access generated classes on classpath

I've generated the Apollo classes successfully and can see them in the build directory, however they're not available on the classpath. Strangely the Enum that is generated is available but the classes themselves aren't.

Running the sample project provided on Apollo's Github does work but I cant see the difference between the configurations.

mcve below.

https://github.com/michaeljq/graphQlMCVE

enter image description here

like image 869
Michael. Avatar asked Dec 04 '22 22:12

Michael.


1 Answers

Right now, you have src/main/graphql/ containing GraphQL documents. That means that your Java classes will be generated with no Java package, which probably is not what you want.

Instead, create a package tree under src/main/graphql/ (e.g., src/main/graphql/apollotest/mq/apollotest/api/). Move the GraphQL documents and schema.json there. Clean the project, and you should find that your Apollo-generated classes are available to you in whatever Java package you chose (e.g., apollotest.mq.apollotest.api in the above example).

like image 173
CommonsWare Avatar answered Dec 06 '22 13:12

CommonsWare