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
Sam Michael
01/28/2022, 6:35 AM// 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"))
}
Sam Michael
01/28/2022, 6:46 AMSam Michael
01/28/2022, 7:17 AMalwaysGenerateTypesMatching.set(["Query"])
in parent module build file in apollo {} block seems to be workingmbonnin
01/28/2022, 7:42 AMmbonnin
01/28/2022, 8:23 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 PMmbonnin
02/03/2022, 4:20 PMapollo {
service("service1")ย {
packageName.set("com.service1")
}
}
module2:
apollo {
service("service2")ย {
packageName.set("com.service2")
}
}
Sam Michael
02/03/2022, 4:21 PMSam Michael
02/03/2022, 7:04 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 {}
blockmbonnin
02/03/2022, 7:09 PMSam Michael
02/03/2022, 7:10 PMSam Michael
02/03/2022, 7:10 PMmbonnin
02/03/2022, 7:11 PMmbonnin
02/03/2022, 7:12 PMmbonnin
02/03/2022, 7:12 PMschemaFile.set()
Sam Michael
02/03/2022, 7:13 PMSam Michael
02/03/2022, 7:13 PMSam Michael
02/03/2022, 7:14 PMSam Michael
02/03/2022, 7:14 PMSam Michael
02/03/2022, 7:15 PMSam Michael
02/03/2022, 7:15 PMmbonnin
02/03/2022, 7:15 PMschemaFile.set()
should be in the core module if you're using multi modulembonnin
02/03/2022, 7:16 PMpackage
is suspicious. It should be packageName
iircSam Michael
02/03/2022, 7:16 PMmbonnin
02/03/2022, 7:17 PMmbonnin
02/03/2022, 7:18 PMmbonnin
02/03/2022, 7:39 PMmbonnin
02/03/2022, 7:43 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 PMmbonnin
02/03/2022, 8:20 PMSam Michael
02/03/2022, 8:20 PMmbonnin
02/03/2022, 8:20 PMSam Michael
02/03/2022, 8:21 PMSam Michael
02/03/2022, 8:22 PMmbonnin
02/03/2022, 8:22 PMSam Michael
02/03/2022, 8:22 PMSam Michael
02/03/2022, 8:23 PMmbonnin
02/03/2022, 8:23 PMmbonnin
02/03/2022, 8:23 PMSam Michael
02/03/2022, 8:24 PMSam Michael
02/03/2022, 8:24 PMmbonnin
02/03/2022, 8:24 PMmbonnin
02/03/2022, 8:25 PMmbonnin
02/03/2022, 8:25 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 PMmbonnin
02/03/2022, 8:27 PMmbonnin
02/03/2022, 8:27 PMapollo {
packageName.set("com.example")
}
mbonnin
02/03/2022, 8:28 PMSam Michael
02/03/2022, 8:28 PMmbonnin
02/03/2022, 8:29 PMmbonnin
02/03/2022, 8:29 PMmbonnin
02/03/2022, 8:30 PMmbonnin
02/03/2022, 8:31 PMfeature1/src/main/graphql/schema.json
and your first query:
feature1/src/main/graphql/MyQuery.graphql
mbonnin
02/03/2022, 8:32 PM./gradlew :feature1:generateApolloSources
(or hit the play button in Android Studio)Sam Michael
02/03/2022, 8:47 PMSam Michael
02/03/2022, 8:48 PMmbonnin
02/03/2022, 8:48 PMmbonnin
02/03/2022, 8:49 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?
mbonnin
02/03/2022, 8:50 PMSam Michael
02/03/2022, 8:50 PMmbonnin
02/03/2022, 8:50 PMmbonnin
02/03/2022, 8:52 PMgenerateApolloMetadata
and apolloMetadata
mbonnin
02/03/2022, 8:52 PMSam Michael
02/03/2022, 8:52 PMmbonnin
02/03/2022, 8:53 PMmbonnin
02/03/2022, 8:53 PMSam Michael
02/03/2022, 8:53 PMmbonnin
02/03/2022, 8:54 PMmbonnin
02/03/2022, 8:54 PMSam Michael
02/03/2022, 8:54 PMmbonnin
02/03/2022, 8:54 PMmbonnin
02/03/2022, 8:55 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