posthog_flutter 5.42.1 and 5.47.0 fail to compile on Android Gradle Plugin 9.2 when android.builtInKotlin=false (the Flutter migrator default).
e: PosthogFlutterPlugin.kt:154:34 Unresolved reference 'SnapshotSender'.
e: PosthogFlutterPlugin.kt:158:41 Unresolved reference 'PostHogFlutterSurveysDelegate'.
e: PosthogFlutterPlugin.kt:651:40 Unresolved reference 'PostHogFlutterSurveysDelegate'.
e: PosthogFlutterPlugin.kt:2202:33 Unresolved reference 'handleSurveyAction'.
SnapshotSender, PostHogFlutterSurveysDelegate, and handleSurveyAction are all in android/src/main/kotlin/com/posthog/flutter/, same package as PosthogFlutterPlugin.kt. They are unresolved because android/build.gradle still does:
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
AGP 9 does not support adding Kotlin sources to the Java source set (migration guide). Those .kt files are then compiled apart from the Kotlin source set, so sibling classes are invisible. 5.47.0 still has this block.
Please stop adding src/main/kotlin to java.srcDirs. src/main/kotlin is already the Kotlin source directory for both KGP and built-in Kotlin.
Toolchain: AGP 9.2.0, Kotlin 2.2.20, android.builtInKotlin=false, android.newDsl=false.
posthog_flutter5.42.1 and 5.47.0 fail to compile on Android Gradle Plugin 9.2 whenandroid.builtInKotlin=false(the Flutter migrator default).SnapshotSender,PostHogFlutterSurveysDelegate, andhandleSurveyActionare all inandroid/src/main/kotlin/com/posthog/flutter/, same package asPosthogFlutterPlugin.kt. They are unresolved becauseandroid/build.gradlestill does:AGP 9 does not support adding Kotlin sources to the Java source set (migration guide). Those
.ktfiles are then compiled apart from the Kotlin source set, so sibling classes are invisible. 5.47.0 still has this block.Please stop adding
src/main/kotlintojava.srcDirs.src/main/kotlinis already the Kotlin source directory for both KGP and built-in Kotlin.Toolchain: AGP 9.2.0, Kotlin 2.2.20,
android.builtInKotlin=false,android.newDsl=false.