Search code examples
apolloapollo-android

Can't download json schema using gradlew command


I can't figure out how to use the gradlew command to convert my GraphQL schema into a JSON file as it is specified in the documentation.

I opened CMD in my project folder, ran the gradlew command once, and it gave me this error:

Project 'module' not found in root project gradlew

I created a module inside my project with the name "module" and now it's throwing the following error:

Task 'downloadApolloSchema' not found in project ':module'.

I've already added all the dependencies to the latest version (2.0.0 as of the time of posting) so I'm clueless as to why this is happening. I've already searched the web and found nothing about this...

This is the command I'm trying to issue in the CMD:

C:\Users\myuser\AndroidStudioProjects\GraphQLApp\app>..\gradlew :module:downloadApolloSchema -Pcom.apollographql.apollo.endpoint=https://graphql-udemy-android.herokuapp.com/graphql -Pcom.apollographql.apollo.schema=src/main/graphql/com/example/schema.json

I have to go up one directory (..\) since the gradlew command is in the above my app folder.

I'm on Windows, and my Gradle version is 6.4.


Solution

  • Sorry about that, the module part was mostly a placeholder for the gradle module where you apply the com.apollographql.apollo plugin. You can ignore it and gradle will find the appropriate task:

    ./gradlew downloadApolloSchema
    

    This has been updated in the project README as well.