Abu*_*suf 4 android apollo graphql apollo-client graphql-java
我在 Android 项目中使用 Apollo 客户端。我有 2 个架构文件,并将它们放在 2 个不同的目录中。
但是当我构建一个项目来通过 Apollo 生成代码时,它给了我一个错误:
ApolloGraphQL: By default, only one schema.json file is supported.
并建议我使用多个服务 构建输出:
ApolloGraphQL: By default, only one schema.json file is supported. Please use multiple services instead:
apollo {
service("search") {
sourceFolder = "/.../app/src/main/graphql/com/example/data/search"
}
service("customer") {
sourceFolder = "/.../app/src/main/graphql/com/example/data/customer"
}
}
Run Code Online (Sandbox Code Playgroud)
我还将其添加到我的build.gradle
(应用程序级别)文件中,但仍然显示相同的构建错误。
请建议我如何解决这个错误
我的问题已通过此配置解决
apollo {
// configure ApolloExtension here
generateKotlinModels.set(false) // Generate Kotlin models for all services
service("search") {
sourceFolder.set("com/example/data/search")
rootPackageName.set("com.example.data.search")
}
service("customer") {
sourceFolder.set("com/example/data/customer")
rootPackageName.set("com.example.data.customer")
}
onCompilationUnit {
// Overwrite some options here for single CompilationUnit if needed
}
}
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助其他人
归档时间: |
|
查看次数: |
3486 次 |
最近记录: |