android-collar icon indicating copy to clipboard operation
android-collar copied to clipboard

Build issues with kotlin 2.1.20 version

Open mihaelKampic opened this issue 1 year ago • 2 comments

:writing_hand: Describe the bug

After increase kotlin and ksp version to 2.1.20, project sync successfully, but fails during build. The reason is that trackEvent functions cannot be resolved.

In kotlin 2.1.20, the K2 implementation of the kapt compiler plugin is enabled by default. I am wondering if the unalignment of kapt compiler implementations is causing this issue.

stacktrace:

e: file:///Users/user/somepath//projectapp/src/main/java/com/example/project/ui/shared/views/PublicOptionsLayout.kt:77:21 Unresolved reference 'trackEvent'

:bomb: Steps to reproduce

  1. Increase kotlin version to 2.1.20 and ksp version to 2.1.20-1.0.31
  2. Build project
  3. See error

:wrench: Expected behavior

Project should build successfully, generating trackEvent functions and importing them without any errors.

:iphone: Tech info

  • Android Studio version: Android Studio Meerkat | 2024.3.1
  • kotlin version: 2.1.20
  • ksp version: 2.1.20-1.0.31
  • AGP version: 8.9.0
  • gradle version: 8.11.1
  • Collar version: 1.4.0

mihaelKampic avatar Mar 25 '25 12:03 mihaelKampic

@thisAAY regarding the issue, I've noticed that Collar version 1.4.0 uses kotlin-inject v0.6.1, while support for KSP2 was added in v0.8.0. Updating Collar to this version might resolve the issue.

mihaelKampic avatar Jul 14 '25 08:07 mihaelKampic

Will definitely check it, thanks

thisAAY avatar Jul 15 '25 08:07 thisAAY