Sam Michael
01/28/2022, 6:32 AMExecution failed for task ':checkServiceApolloDuplicates'.
duplicate Type 'ResolverKey(kind=SchemaType, id=Query)' generated in modules: Somthing,SomethingElse
Use 'alwaysGenerateTypesMatching' in a parent module to generate the type only once
// shared/build.gradle.kts
apollo {
// For an example if ReviewInput clashes
alwaysGenerateTypesMatching.set(listOf("ReviewInput"))
// You can also pass Regex patterns
alwaysGenerateTypesMatching.set(listOf(".*Input"))
}
alwaysGenerateTypesMatching.set(["Query"])
in parent module build file in apollo {} block seems to be workingmbonnin
01/28/2022, 7:42 AMSam Michael
02/03/2022, 3:54 PM':checkServiceApolloDuplicates'
gradle task. I guess maybe because there is no parent module, they are both totally separate, so there is no correct module to suppress from. I tried also registering as separate services as I saw you suggest in another issue: https://spectrum.chat/apollo/apollo-android/apollo-multi-module-with-multiple-apps-in-a-project~eaa042ad-49db-470e-b044-d5423891ad70
What is the best way to have 2 separate services using apollo in the same project? Thanksmbonnin
02/03/2022, 4:19 PMapollo {
service("service1") {
packageName.set("com.service1")
}
}
module2:
apollo {
service("service2") {
packageName.set("com.service2")
}
}
Sam Michael
02/03/2022, 4:21 PMMultiple schemas found:
Use different services for different schemas
// core
apollo {
package.set(“core”)
generateKotlinModels.set(true)
generateApolloMetadata.set(true)
}
// child1
apolloMetadata(“core”)
apollo {
package.set(“child1)
}
// child2
apolloMetadata(“core”)
apollo {
package.set(“child2”)
}mbonnin
02/03/2022, 7:08 PMservice {}
blockSam Michael
02/03/2022, 7:10 PMmbonnin
02/03/2022, 7:11 PMschemaFile.set()
Sam Michael
02/03/2022, 7:13 PMmbonnin
02/03/2022, 7:15 PMschemaFile.set()
should be in the core module if you're using multi modulepackage
is suspicious. It should be packageName
iircSam Michael
02/03/2022, 7:16 PMmbonnin
02/03/2022, 7:17 PMschemaFile.set()
Sam Michael
02/03/2022, 8:09 PMmbonnin
02/03/2022, 8:14 PMSam Michael
02/03/2022, 8:19 PMmbonnin
02/03/2022, 8:19 PMSam Michael
02/03/2022, 8:20 PMmbonnin
02/03/2022, 8:20 PMSam Michael
02/03/2022, 8:21 PMmbonnin
02/03/2022, 8:22 PMSam Michael
02/03/2022, 8:22 PMmbonnin
02/03/2022, 8:23 PMSam Michael
02/03/2022, 8:24 PMmbonnin
02/03/2022, 8:24 PMSam Michael
02/03/2022, 8:25 PMmbonnin
02/03/2022, 8:26 PMSam Michael
02/03/2022, 8:26 PMmbonnin
02/03/2022, 8:26 PMSam Michael
02/03/2022, 8:26 PMmbonnin
02/03/2022, 8:27 PMapollo {
packageName.set("com.example")
}
Sam Michael
02/03/2022, 8:28 PMmbonnin
02/03/2022, 8:29 PMfeature1/src/main/graphql/schema.json
and your first query:
feature1/src/main/graphql/MyQuery.graphql
./gradlew :feature1:generateApolloSources
(or hit the play button in Android Studio)Sam Michael
02/03/2022, 8:47 PMmbonnin
02/03/2022, 8:48 PMI don't think it lets me move the queries into the feature1 moduleNot sure I understand. You already have multiple queries? Where are they coming from ? The retrofit implementation you were mentioning before?
Sam Michael
02/03/2022, 8:50 PMmbonnin
02/03/2022, 8:50 PMgenerateApolloMetadata
and apolloMetadata
Sam Michael
02/03/2022, 8:52 PMmbonnin
02/03/2022, 8:53 PMSam Michael
02/03/2022, 8:53 PMmbonnin
02/03/2022, 8:54 PMSam Michael
02/03/2022, 8:54 PMmbonnin
02/03/2022, 8:54 PM.graphql
file next to the first one without even touching the Gradle configurationSam Michael
02/03/2022, 8:56 PMmbonnin
02/03/2022, 8:56 PMSam Michael
02/03/2022, 8:57 PMmbonnin
02/03/2022, 8:58 PM