bumptech / bumptech/glide

Build fails when OkHttp3 Integration Library is used with KSP2

Open
#5,500 1 comment 14 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

Hello,

when I try to create a project with both the okhttp3 integration artifact and the KSP plugin with KSP2 enabled, the creation fails with the following exception when KSP tries to generate the `AppGlideModule`:

> [ksp] java.lang.IllegalArgumentException: this and base files have different roots: C:\Users\user\.gradle\caches\8.11.1\transforms\e5c45dfd68c0cc6b5948d1d2b2ddf43b\transformed\okhttp3-integration-4.16.0-api.jar!\com\bumptech\glide\annotation\compiler\GlideIndexer_GlideModule_com_bumptech_glide_integration_okhttp3_OkHttpLibraryGlideModule.class and D:\repos\MyApplication\app.

However, the build works if:
- Removing the okhttp3 integration artifact
- Removing the `@GlideModule` annotation or using a `LibraryGlideModule` instead
- Going back to KSP1 (or using KAPT..)
- Move the project to the same drive as the Gradle cache (C: in my case). I found this open [issue] (https://github.com/google/ksp/issues/1079) in KSP that might be related.

My setup:
- Android Studio Meerkat | 2024.3.1 Patch 1
- Windows 11
- Gradle
- Glide 4.16.0
- Kotlin 2.1.20 with KSP 2.1.20-1.0.32

I tried Kotlin 2 with the related KSP versions from 2.0.21 to 2.1.20. It works up to 2.1.20-1.0.32 where KSP2 is disabled, but it stops working when I enable KSP2 in that version. It also does not work with 2.1.20-2.0.0 which has KSP2 enabled by default, which makes the connection even clearer. Glide 5.0.0-rc01 does not seem to fix this problem.

Please find a minimal reproducible example here:
[My Application.zip](https://github.com/user-attachments/files/19721097/My.Application.zip)

Is this known already by any chance?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.