androidgradlegroovygraphqlapollo

Android apollo3 schema not found


I'm trying to use local schema from this url: https://spacex-production.up.railway.app/

In my data module I have

apollo {
    service("RocketsGraphQL") {
        packageName.set("com.example.data")
        schemaFiles.from("src/main/graphql/schema.graphqls")
    }
}

enter image description here

Error: Caused by: java.lang.IllegalStateException: No schema file found in:

In my schema.graphqls

""""""
type Address {
    """"""
    address: String

    """"""
    city: String

    """"""
    state: String
}

Solution

  • As per Apollo3, you should explicitly set srcDir().

    Reference: Specifying schema and .graphql files

    This should be sufficient. I don't even have schemaFiles.from in my app:

    apollo {
        service("RocketsGraphQL") {
            srcDir("src/main/graphql")
            packageName.set("com.example.data")
        }
    }