-
Notifications
You must be signed in to change notification settings - Fork 694
Description
Version
4.4.1 - 5.0.0-alpha.4
Summary
after updating to AGP9
(built-in kotlin=true AND newDsl=true)
afterEvaluate causing Unable to load class 'com.android.Version' com.android.Version error for apollo { service ... } block
I want to highlight that outside afterEvaluate (or other gradle late lifecycle callbacks) apollo { ... } works without this error. Tested on 4.4.1 and above up to 5.0.0-alpha.4
In my case afterEvaluate is required to gather apollo-related project dependencies (dependOn(...)) for graphql convention plugin to automatically register dependsOn
Before AGP9 apollo is working inside afterEvaluate block
I presume it is due to kotlin jvm module no longer can access android.Version
UPDATE:
I was also trying to substitute contextClassLoader to allows to fetch android.Version.
But it still result in other APG9 related errors.
TEMP WORKAROUND
My apollo convention plugin declared apollo block.
afterEvaluate was needed to get resolved child apollo-related project dependencies block from consumer module, whuch were added as dependsOn(...)
So to mitigate these errors I had to apply my convention plugin as last entry in consumer module's build.gradle.kts (after dependencies block) so when apollo is evaluated dependencies are already known.
was at top plugins {... alias("my-plugin")}; became: at bottom apply(plugin = "my-plugin")
additionally at a top I have to declare another convention plugin with extension to manually configure module that should be treated as dependOn because withPlugin("com.apollographql.apollo") somehow not resolved for every project(dep.path)
Steps to reproduce the behavior
No response
Logs
Unable to load class 'com.android.Version'
com.android.Version