Search code examples
androidgradle

Why are not all classes of dependency imported?


I am working on a legacy android project and trying to import the dependency

com.vanniktech:android-image-cropper:4.3.3

The dependency is loaded without errors or warnings however when importing e.g.

import com.canhub.cropper.CropImage;

I am getting Cannot resolve symbol CropImage. When looking at the package, you can see that a lot of classes are missing:

enter image description here

Any idea what the reason might be? I have the same issue regardless of the package version I import. My project is configured with gradle 7 and kotlin 1.7.20. The app itself is written in Java.


Solution

  • From a quick go including the lib in an empty project, the classes seem to be loaded correctly (I went for the latest version but same holds true for 4.3.3).

    That points to the issue being related to gradle or something in the local environment, some bits to double check:

    • Is the package you're looking at (in the above screen) part of the External Libraries (Project View in AS shows them separately) or part of your own "App"? (if the latter, drop the package and sync gradle deps again)
    • Did you try cleaning? (ie. ./gradlew clean / AS "Invalidate caches and restart")
    • Did you check your dependency graph (./gradlew dependencies) to verify some other dependency isn't importing an older version of the same lib?

    enter image description here