javaandroidkotlinretrofitretrofit2

Cannot access class 'retrofit2.Response'. Check your module classpath for missing or conflicting dependencies


I started a project with a few modules and i have problems when i build the app.

Cannot access class 'retrofit2.Response'. Check your module classpath for missing or conflicting dependencies

I also had problems with Gson but i tried something to dont have that error.

Im using TOML versions.

im using JDK 17 coretto

My service has suspend fun getProducts(): Response< ResponseBody>. Thats is in one module. And the datasource, who calls that function, is in another module.

enter image description here

But in IDE is not red, just in Build window. I tried everything that i found on internet.

Downgrade kotlin version, Retrofit version. I cant download other android studio version because the page doesnt gave other version that the last one.

Im using Android Studio koala 2024


Solution

  • Since there is no build.gradle provided, I can only assume based on the behavior ...
    You may have to add the dependency as api in the secondary module, which uses it.