apollographql / apollo-kotlin

:rocket:  A strongly-typed, caching GraphQL client for the JVM, Android, and Kotlin multiplatform.
https://www.apollographql.com/docs/kotlin
MIT License
3.76k stars 653 forks source link

Could not initialize class com.apollographql.apollo.compiler.parser.Schema #2359

Closed piotr-pawlowski closed 4 years ago

piotr-pawlowski commented 4 years ago

I receive that error:

Execution failed for task ':app:generateDebugServiceApolloSources'.
> Could not initialize class com.apollographql.apollo.compiler.parser.Schema

Apollo Android v2.2.0 Gradle 6.4 What's wrong?

martinbonnin commented 4 years ago

I've seen a similar error on the kotlinlang slack.

The problem was that buildSrc was pulling an older version of okio in the buildscript classpath that did not contain String. decodeHex(). Usually, this is resolved by bumping the okio version in buildSrc/build.gradle.kts to 2.5.0.

The more general issue behind this is that there is no conflict resolution for buildSrc so everything in buildSrc takes precedence.

piotr-pawlowski commented 4 years ago

Should all apollo dependencies be placed in root/build.gradle or app/build.gradle?

martinbonnin commented 4 years ago

apollo-runtime, apollo-coroutines-support, etc.. should be in app/build.gradle.

For the plugin, I recommend you use the new syntax and also put it in app/build.gradle:

plugins {
  id "com.apollographql.apollo" version "2.2.0"
}

There are other ways to do it but the above is the simplest one.

That being said, I think the issue comes from buildSrc. Do you use buildSrc in your project?

piotr-pawlowski commented 4 years ago

I do not use buildSrc. Everything is configured as in tutorial or https://github.com/apollographql/apollo-android-tutorial. Android Studio 4.0 Gradle 6.4 Apollo 2.2.0

martinbonnin commented 4 years ago

Ah, interesting! Can you run your build with --stacktrace? ./gradlew :app:assembleDebug --stacktrace

piotr-pawlowski commented 4 years ago
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateDebugServiceApolloSources'.
> Companion

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:generateDebugServiceApolloSources'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:207)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:205)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:186)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:370)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:357)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:350)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: java.lang.NoSuchFieldError: Companion
        at com.apollographql.apollo.compiler.parser.Schema.<clinit>(Schema.kt:120)
        at com.apollographql.apollo.gradle.internal.ApolloGenerateSourcesTask.taskAction(ApolloGenerateSourcesTask.kt:113)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:722)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:689)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:569)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:554)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:537)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:108)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:278)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:267)
        at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)
        at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)
        at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
        at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
        at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34)
        at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)
        at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
        at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43)
        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)
        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
        at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:194)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:186)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:370)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:357)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:350)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
martinbonnin commented 4 years ago
at com.apollographql.apollo.compiler.parser.Schema.<clinit>(Schema.kt:120)

This is the line were apollo uses the new decodeHex from okio so it definitely sounds like there's an old version of okio in the buildscript classpath. Can you run ./gradlew buildEnvironment to see what's in the classpath?

piotr-pawlowski commented 4 years ago
------------------------------------------------------------
Root project
------------------------------------------------------------

classpath
+--- com.android.tools.build:gradle:4.0.0
|    +--- com.android.tools.build:builder:4.0.0
|    |    +--- com.android.tools.build:builder-model:4.0.0
|    |    |    \--- com.android.tools:annotations:27.0.0
|    |    +--- com.android.tools.build:builder-test-api:4.0.0
|    |    |    \--- com.android.tools.ddms:ddmlib:27.0.0
|    |    |         +--- com.android.tools:common:27.0.0
|    |    |         |    +--- com.android.tools:annotations:27.0.0
|    |    |         |    +--- com.google.guava:guava:28.1-jre
|    |    |         |    |    +--- com.google.guava:failureaccess:1.0.1
|    |    |         |    |    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|    |    |         |    |    +--- com.google.code.findbugs:jsr305:3.0.2
|    |    |         |    |    +--- org.checkerframework:checker-qual:2.8.1
|    |    |         |    |    +--- com.google.errorprone:error_prone_annotations:2.3.2
|    |    |         |    |    +--- com.google.j2objc:j2objc-annotations:1.3
|    |    |         |    |    \--- org.codehaus.mojo:animal-sniffer-annotations:1.18
|    |    |         |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72
|    |    |         |         +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72
|    |    |         |         |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72
|    |    |         |         |    \--- org.jetbrains:annotations:13.0
|    |    |         |         \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72
|    |    |         |              \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    |         \--- net.sf.kxml:kxml2:2.3.0
|    |    +--- com.android.tools:sdklib:27.0.0
|    |    |    +--- com.android.tools.layoutlib:layoutlib-api:27.0.0
|    |    |    |    +--- com.android.tools:common:27.0.0 (*)
|    |    |    |    +--- net.sf.kxml:kxml2:2.3.0
|    |    |    |    +--- com.android.tools:annotations:27.0.0
|    |    |    |    \--- org.jetbrains:annotations:13.0
|    |    |    +--- com.android.tools:dvlib:27.0.0
|    |    |    |    \--- com.android.tools:common:27.0.0 (*)
|    |    |    +--- com.android.tools:repository:27.0.0
|    |    |    |    +--- com.android.tools:common:27.0.0 (*)
|    |    |    |    +--- com.sun.activation:javax.activation:1.2.0
|    |    |    |    +--- org.apache.commons:commons-compress:1.12
|    |    |    |    +--- org.glassfish.jaxb:jaxb-runtime:2.3.1
|    |    |    |    |    +--- javax.xml.bind:jaxb-api:2.3.1
|    |    |    |    |    |    \--- javax.activation:javax.activation-api:1.2.0
|    |    |    |    |    +--- org.glassfish.jaxb:txw2:2.3.1
|    |    |    |    |    +--- com.sun.istack:istack-commons-runtime:3.0.7
|    |    |    |    |    +--- org.jvnet.staxex:stax-ex:1.8
|    |    |    |    |    +--- com.sun.xml.fastinfoset:FastInfoset:1.2.15
|    |    |    |    |    \--- javax.activation:javax.activation-api:1.2.0
|    |    |    |    +--- com.google.jimfs:jimfs:1.1
|    |    |    |    |    \--- com.google.guava:guava:18.0 -> 28.1-jre (*)
|    |    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 (*)
|    |    |    +--- com.google.code.gson:gson:2.8.5
|    |    |    +--- org.apache.commons:commons-compress:1.12
|    |    |    +--- org.apache.httpcomponents:httpmime:4.5.6
|    |    |    |    \--- org.apache.httpcomponents:httpclient:4.5.6
|    |    |    |         +--- org.apache.httpcomponents:httpcore:4.4.10
|    |    |    |         +--- commons-logging:commons-logging:1.2
|    |    |    |         \--- commons-codec:commons-codec:1.10
|    |    |    \--- org.apache.httpcomponents:httpcore:4.4.10
|    |    +--- com.android.tools:sdk-common:27.0.0
|    |    |    +--- com.android.tools:sdklib:27.0.0 (*)
|    |    |    +--- com.android.tools.build:builder-test-api:4.0.0 (*)
|    |    |    +--- com.android.tools.build:builder-model:4.0.0 (*)
|    |    |    +--- com.android.tools.ddms:ddmlib:27.0.0 (*)
|    |    |    +--- com.android.tools.analytics-library:shared:27.0.0
|    |    |    |    +--- com.android.tools.analytics-library:protos:27.0.0
|    |    |    |    |    \--- com.google.protobuf:protobuf-java:3.10.0
|    |    |    |    +--- com.android.tools:annotations:27.0.0
|    |    |    |    +--- com.android.tools:common:27.0.0 (*)
|    |    |    |    +--- com.google.guava:guava:28.1-jre (*)
|    |    |    |    +--- com.google.code.gson:gson:2.8.5
|    |    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 (*)
|    |    |    +--- org.bouncycastle:bcpkix-jdk15on:1.56
|    |    |    |    \--- org.bouncycastle:bcprov-jdk15on:1.56
|    |    |    +--- org.bouncycastle:bcprov-jdk15on:1.56
|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 (*)
|    |    |    +--- org.jetbrains.kotlin:kotlin-reflect:1.3.72
|    |    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    |    +--- com.google.protobuf:protobuf-java:3.10.0
|    |    |    +--- javax.inject:javax.inject:1
|    |    |    +--- org.jetbrains.trove4j:trove4j:20160824
|    |    |    \--- com.android.tools.build:aapt2-proto:0.4.0 -> 4.0.0-6051327
|    |    |         \--- com.google.protobuf:protobuf-java:3.10.0
|    |    +--- com.android.tools:common:27.0.0 (*)
|    |    +--- com.android.tools.build:manifest-merger:27.0.0
|    |    |    +--- com.android.tools:common:27.0.0 (*)
|    |    |    +--- com.android.tools:sdklib:27.0.0 (*)
|    |    |    +--- com.android.tools:sdk-common:27.0.0 (*)
|    |    |    +--- com.google.code.gson:gson:2.8.5
|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 (*)
|    |    |    \--- net.sf.kxml:kxml2:2.3.0
|    |    +--- com.android.tools.ddms:ddmlib:27.0.0 (*)
|    |    +--- com.android:zipflinger:4.0.0
|    |    |    +--- com.google.guava:guava:27.0.1-jre -> 28.1-jre (*)
|    |    |    \--- com.android.tools:common:27.0.0 (*)
|    |    +--- com.android:signflinger:4.0.0
|    |    |    +--- com.android.tools.build:apksig:4.0.0
|    |    |    \--- com.android:zipflinger:4.0.0 (*)
|    |    +--- com.android.tools.analytics-library:protos:27.0.0 (*)
|    |    +--- com.android.tools.analytics-library:tracker:27.0.0
|    |    |    +--- com.android.tools:annotations:27.0.0
|    |    |    +--- com.android.tools:common:27.0.0 (*)
|    |    |    +--- com.android.tools.analytics-library:protos:27.0.0 (*)
|    |    |    +--- com.android.tools.analytics-library:shared:27.0.0 (*)
|    |    |    +--- com.google.protobuf:protobuf-java:3.10.0
|    |    |    +--- com.google.guava:guava:28.1-jre (*)
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 (*)
|    |    +--- com.android.tools.build:apksig:4.0.0
|    |    +--- com.android.tools.build:apkzlib:4.0.0
|    |    |    +--- com.google.code.findbugs:jsr305:1.3.9 -> 3.0.2
|    |    |    +--- com.google.guava:guava:23.0 -> 28.1-jre (*)
|    |    |    +--- org.bouncycastle:bcpkix-jdk15on:1.56 (*)
|    |    |    +--- org.bouncycastle:bcprov-jdk15on:1.56
|    |    |    \--- com.android.tools.build:apksig:4.0.0
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 (*)
|    |    +--- com.squareup:javawriter:2.5.0
|    |    +--- org.bouncycastle:bcpkix-jdk15on:1.56 (*)
|    |    +--- org.bouncycastle:bcprov-jdk15on:1.56
|    |    +--- org.ow2.asm:asm:7.0
|    |    +--- org.ow2.asm:asm-tree:7.0
|    |    |    \--- org.ow2.asm:asm:7.0
|    |    +--- javax.inject:javax.inject:1
|    |    +--- org.ow2.asm:asm-commons:7.0
|    |    |    +--- org.ow2.asm:asm:7.0
|    |    |    +--- org.ow2.asm:asm-tree:7.0 (*)
|    |    |    \--- org.ow2.asm:asm-analysis:7.0
|    |    |         \--- org.ow2.asm:asm-tree:7.0 (*)
|    |    +--- org.ow2.asm:asm-util:7.0
|    |    |    +--- org.ow2.asm:asm:7.0
|    |    |    +--- org.ow2.asm:asm-tree:7.0 (*)
|    |    |    \--- org.ow2.asm:asm-analysis:7.0 (*)
|    |    +--- it.unimi.dsi:fastutil:7.2.0
|    |    +--- net.sf.jopt-simple:jopt-simple:4.9
|    |    \--- com.googlecode.json-simple:json-simple:1.1
|    +--- com.android.tools.build:aaptcompiler:4.0.0
|    |    +--- com.android.tools.build:aapt2-proto:4.0.0-6051327 (*)
|    |    +--- com.android.tools.layoutlib:layoutlib-api:27.0.0 (*)
|    |    +--- com.google.guava:guava:28.1-jre (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 (*)
|    +--- com.android.tools.analytics-library:crash:27.0.0
|    |    +--- com.android.tools:annotations:27.0.0
|    |    +--- com.google.guava:guava:28.1-jre (*)
|    |    +--- org.apache.httpcomponents:httpmime:4.5.6 (*)
|    |    +--- org.apache.httpcomponents:httpcore:4.4.10
|    |    \--- org.apache.httpcomponents:httpclient:4.5.6 (*)
|    +--- com.android.tools.lint:lint-gradle-api:27.0.0
|    |    +--- com.android.tools:sdklib:27.0.0 (*)
|    |    +--- com.android.tools.build:builder-model:4.0.0 (*)
|    |    +--- com.android.tools.build:gradle-api:4.0.0
|    |    |    +--- com.android.tools.build:builder-test-api:4.0.0 (*)
|    |    |    +--- com.google.guava:guava:28.1-jre (*)
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-reflect:1.3.72 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 (*)
|    |    \--- com.google.guava:guava:28.1-jre (*)
|    +--- com.android.tools.build:gradle-api:4.0.0 (*)
|    +--- androidx.databinding:databinding-compiler-common:4.0.0
|    |    +--- androidx.databinding:databinding-common:4.0.0
|    |    +--- com.android.databinding:baseLibrary:4.0.0
|    |    +--- org.antlr:antlr4:4.5.3
|    |    +--- commons-io:commons-io:2.4
|    |    +--- com.googlecode.juniversalchardet:juniversalchardet:1.0.3
|    |    +--- com.google.guava:guava:28.1-jre (*)
|    |    +--- com.squareup:javapoet:1.10.0
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 (*)
|    |    +--- com.google.code.gson:gson:2.8.5
|    |    +--- org.glassfish.jaxb:jaxb-runtime:2.3.1 (*)
|    |    +--- com.android.tools:annotations:27.0.0
|    |    \--- com.android.tools.build.jetifier:jetifier-core:1.0.0-beta09
|    |         +--- com.google.code.gson:gson:2.8.0 -> 2.8.5
|    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.60 -> 1.3.72 (*)
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 (*)
|    +--- com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api
|    +--- org.ow2.asm:asm:7.0
|    +--- org.ow2.asm:asm-analysis:7.0 (*)
|    +--- org.ow2.asm:asm-commons:7.0 (*)
|    +--- org.ow2.asm:asm-util:7.0 (*)
|    +--- net.sf.jopt-simple:jopt-simple:4.9
|    +--- net.sf.proguard:proguard-gradle:6.0.3
|    |    \--- net.sf.proguard:proguard-base:6.0.3
|    +--- com.android.tools.build:bundletool:0.13.2
|    |    +--- com.android.tools.build:aapt2-proto:0.4.0 -> 4.0.0-6051327 (*)
|    |    +--- com.google.auto.value:auto-value-annotations:1.6.2
|    |    +--- com.google.errorprone:error_prone_annotations:2.3.1 -> 2.3.2
|    |    +--- com.google.guava:guava:27.0.1-jre -> 28.1-jre (*)
|    |    +--- com.google.protobuf:protobuf-java:3.4.0 -> 3.10.0
|    |    \--- com.google.protobuf:protobuf-java-util:3.4.0 -> 3.10.0
|    |         +--- com.google.protobuf:protobuf-java:3.10.0
|    |         +--- com.google.guava:guava:28.0-android -> 28.1-jre (*)
|    |         +--- com.google.errorprone:error_prone_annotations:2.3.2
|    |         \--- com.google.code.gson:gson:2.8.5
|    +--- com.android.tools.build.jetifier:jetifier-core:1.0.0-beta09 (*)
|    +--- com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta09
|    |    +--- com.android.tools.build.jetifier:jetifier-core:1.0.0-beta09 (*)
|    |    +--- org.ow2.asm:asm:6.0 -> 7.0
|    |    +--- org.ow2.asm:asm-util:6.0 -> 7.0 (*)
|    |    +--- org.ow2.asm:asm-commons:6.0 -> 7.0 (*)
|    |    +--- org.jdom:jdom2:2.0.6
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.60 -> 1.3.72 (*)
|    +--- com.google.protobuf:protobuf-java:3.10.0
|    +--- com.google.protobuf:protobuf-java-util:3.10.0 (*)
|    \--- com.google.crypto.tink:tink:1.3.0-rc2
|         +--- com.google.protobuf:protobuf-java:3.10.0
|         \--- org.json:json:20180813
+--- com.google.gms:google-services:4.3.3
|    +--- com.google.android.gms:strict-version-matcher-plugin:1.2.1
|    |    +--- com.google.code.findbugs:jsr305:3.0.2
|    |    +--- com.google.guava:guava:27.0.1-jre -> 28.1-jre (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.11 -> 1.3.72 (*)
|    +--- com.google.code.gson:gson:2.8.5
|    \--- com.google.guava:guava:27.0.1-jre -> 28.1-jre (*)
+--- io.fabric.tools:gradle:1.31.2
+--- androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0-beta02
|    +--- com.android.tools.build:gradle:3.4.0 -> 4.0.0 (*)
|    +--- org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20 -> 1.3.72
|    |    +--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    |    +--- org.jetbrains.kotlin:kotlin-script-runtime:1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-reflect:1.3.72 (*)
|    |    |    +--- org.jetbrains.kotlin:kotlin-daemon-embeddable:1.3.72
|    |    |    \--- org.jetbrains.intellij.deps:trove4j:1.0.20181211
|    |    +--- org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.72 (*)
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-android-extensions:1.3.72
|    |    |    \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.72 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-compiler-runner:1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-build-common:1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-daemon-client:1.3.72
|    |    |    |    +--- org.jetbrains.kotlin:kotlin-reflect:1.3.72 (*)
|    |    |    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1
|    |    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1
|    |    +--- org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.3.72
|    |    |    |    +--- org.jetbrains.kotlin:kotlin-scripting-common:1.3.72
|    |    |    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    |    |    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1
|    |    |    |    +--- org.jetbrains.kotlin:kotlin-scripting-jvm:1.3.72
|    |    |    |    |    +--- org.jetbrains.kotlin:kotlin-script-runtime:1.3.72
|    |    |    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    |    |    |    \--- org.jetbrains.kotlin:kotlin-scripting-common:1.3.72 (*)
|    |    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    |    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.3.72 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-reflect:1.3.72 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    |    \--- org.jetbrains.kotlin:kotlin-native-utils:1.3.72
|    |    |         +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    |         \--- org.jetbrains.kotlin:kotlin-util-io:1.3.72
|    |    |              \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.3.72
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-native-utils:1.3.72 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-util-klib:1.3.72
|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
|    |    |    \--- org.jetbrains.kotlin:kotlin-util-io:1.3.72 (*)
|    |    +--- com.google.code.gson:gson:2.8.5
|    |    \--- de.undercouch:gradle-download-task:4.0.2
|    +--- androidx.navigation:navigation-safe-args-generator:2.1.0-beta02
|    |    +--- xpp3:xpp3:1.1.4c
|    |    +--- xmlpull:xmlpull:1.1.3.1
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.40 -> 1.3.72 (*)
|    |    +--- com.squareup:javapoet:1.8.0 -> 1.10.0
|    |    \--- com.squareup:kotlinpoet:1.1.0 -> 1.5.0
|    |         +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61 -> 1.3.72 (*)
|    |         \--- org.jetbrains.kotlin:kotlin-reflect:1.3.61 -> 1.3.72 (*)
|    \--- com.google.code.gson:gson:2.8.0 -> 2.8.5
+--- org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72 (*)
\--- com.squareup.sqldelight:gradle-plugin:1.3.0
     +--- com.squareup.sqldelight:core:1.3.0
     |    +--- com.alecstrong:sqlite-psi-core:0.2.1
     |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61 -> 1.3.72 (*)
     |    +--- com.squareup:kotlinpoet:1.5.0 (*)
     |    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.71 -> 1.3.72 (*)
     |    \--- com.squareup.moshi:moshi:1.9.2
     |         \--- com.squareup.okio:okio:1.16.0
     +--- com.squareup.sqldelight:migrations:1.3.0
     |    +--- com.alecstrong:sqlite-psi-core:0.2.1 (*)
     |    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.71 -> 1.3.72 (*)
     |    +--- org.xerial:sqlite-jdbc:3.21.0.1
     |    +--- de.danielbechler:java-object-diff:0.95
     |    |    \--- org.slf4j:slf4j-api:1.7.22
     |    +--- us.fatehi:schemacrawler-tools:14.16.04.01-java7
     |    |    \--- us.fatehi:schemacrawler-api:14.16.04.01-java7
     |    |         +--- org.threeten:threetenbp:1.3.3
     |    |         \--- com.annimon:stream:1.1.7
     |    \--- us.fatehi:schemacrawler-sqlite:14.16.04.01-java7
     |         +--- us.fatehi:schemacrawler-tools:14.16.04.01-java7 (*)
     |         \--- org.xerial:sqlite-jdbc:3.7.8 -> 3.21.0.1
     +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.71 -> 1.3.72 (*)
     +--- com.alecstrong:sqlite-psi-core:0.2.1 (*)
     +--- com.google.guava:guava:23.0 -> 28.1-jre (*)
     +--- org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71 -> 1.3.72 (*)
     \--- com.android.tools.build:gradle:3.4.1 -> 4.0.0 (*)
martinbonnin commented 4 years ago

My bad, this was for the root buildEnvironment but what would be interesting is the app environment Can you run? ./gradlew :app:buildEnvironment? It should show the apollo-gradle-plugin dependency and okio version 2.5.0

piotr-pawlowski commented 4 years ago
------------------------------------------------------------
Project :app
------------------------------------------------------------

classpath
+--- com.gladed.androidgitversion:com.gladed.androidgitversion.gradle.plugin:0.4.9
|    \--- com.gladed.androidgitversion:gradle-android-git-version:0.4.9
|         \--- org.eclipse.jgit:org.eclipse.jgit:5.2.0.201812061821-r
|              +--- com.jcraft:jsch:0.1.54
|              +--- com.jcraft:jzlib:1.1.1
|              +--- com.googlecode.javaewah:JavaEWAH:1.1.6
|              \--- org.slf4j:slf4j-api:1.7.2
\--- com.apollographql.apollo:com.apollographql.apollo.gradle.plugin:2.1.0
     \--- com.apollographql.apollo:apollo-gradle-plugin:2.1.0
          +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72
          |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72
          |    \--- org.jetbrains:annotations:13.0
          +--- com.squareup.okhttp3:okhttp:4.5.0
          |    +--- com.squareup.okio:okio:2.5.0
          |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.70 -> 1.3.72 (*)
          |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.70 -> 1.3.72
          |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.70 -> 1.3.72 (*)
          +--- com.squareup.moshi:moshi:1.9.2
          |    \--- com.squareup.okio:okio:1.16.0 -> 2.5.0 (*)
          \--- com.apollographql.apollo:apollo-compiler:2.1.0
               +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
               +--- com.squareup.moshi:moshi-adapters:1.9.2
               |    \--- com.squareup.moshi:moshi:1.9.2 (*)
               +--- com.squareup.moshi:moshi:1.9.2 (*)
               +--- com.squareup:javapoet:1.9.0
               +--- com.squareup:kotlinpoet:1.5.0
               |    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61
               |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.61 -> 1.3.72 (*)
               |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61
               |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.61 -> 1.3.72 (*)
               |    \--- org.jetbrains.kotlin:kotlin-reflect:1.3.61
               |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.61 -> 1.3.72 (*)
               +--- com.apollographql.apollo:apollo-api:2.1.0
               |    \--- com.apollographql.apollo:apollo-api-jvm:2.1.0
               |         +--- com.squareup.okio:okio-multiplatform:2.5.0
               |         |    \--- com.squareup.okio:okio:2.5.0 (*)
               |         +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
               |         \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72
               \--- org.antlr:antlr4:4.5.3
martinbonnin commented 4 years ago

Thank you so much! Everything looks as expected.

I noticed you had sqldelight in your root build environment. Maybe try to apply the plugin next to the apollo one ? Or the other way around? Move the apollo plugin next to the sqldelight one?

martinbonnin commented 4 years ago

Ah! I could reproduce by applying the sqldelight plugin in the root project and the apollo one in the app project. So I think the conclusion is that all plugins should be applied in the same place for dependency resolution to work correctly.

I don't think sqldelight supports the new plugins {} syntax so your best bet is to apply the apollo plugin the legacy way:

buildscript {
  ...
  dependencies {
    classpath "com.apollographql.apollo:apollo-gradle-plugin:2.2.0"
  }
}

apply plugin: "com.apollographql.apollo"
piotr-pawlowski commented 4 years ago

Thanks! It works!