Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KSP2 error "Packages cannot be imported" #1772

Open
G00fY2 opened this issue Dec 14, 2023 · 1 comment
Open

KSP2 error "Packages cannot be imported" #1772

G00fY2 opened this issue Dec 14, 2023 · 1 comment
Labels

Comments

@G00fY2
Copy link

G00fY2 commented Dec 14, 2023

We are using Moshi codegen via KSP for a while. We tried to test KSP2 via ksp.useKSP2=true along with kotlin.experimental.tryK2=true but we get build errors for generated Moshi adapters:

e: file:///Users/twirth/AndroidStudioProjects/android-client/common/common-entity/build/generated/ksp/main/kotlin/com/company/entities/common/ecom/CategoryFilterJsonAdapter.kt:14:8 Packages cannot be imported

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':common:common-entity:compileKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction

KSP2 is complaining because of the import kotlin line in the generated adapter classes.

Is this something Moshi can/needs to fix or should I report this issue to the KSP team?

Kotlin: 1.9.21, Moshi: 1.15.0, Gradle: 8.5

@G00fY2 G00fY2 added the bug label Dec 14, 2023
@ZacSweers
Copy link
Collaborator

Do you have a minimallly reproducing code snippet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants