JCenter — It’s Y2K all over again!
Back in early February, JFrog announced that it would be sunsetting JCenter (part of Bintray) on May 1st, 2021. For Android developers this meant that all dependencies hosted on JCenter would have to be migrated off to other hosting services.
Recently one of the Instacart Android teams noticed that some builds were being created with a class that was missing at runtime. The missing class was initially detected thanks to system error logging and R8’s missing class warnings. The missing class was meant to be included as a transitive dependency as part of a library. Upon investigation it was found that local builds contained the class in question but CI builds did not.
The team made use of https://mvnrepository.com/repos/central to compare versions of the dependency from different upstream sources. The same version of the library was found to be hosted on both Maven Central and JCenter. When comparing POM files for this version it became clear that the POM on Maven Central was missing declarations for all transitive dependencies. The team determined that local builds were succeeding due to relying on cached dependencies whereas CI builds were pulling in dependencies fresh with each build.
To fix the issue, the team declared a strict dependence on a hotfix version of the library with the corrected POM file. We then migrated a few remaining dependencies off of JCenter and onto our own private dependency registry typically reserved for hosting private Instacart dependencies.
Some lessons learned:
- Collaborating as a team with each person contributing their unique experience took a confusing problem that might have taken days to figure out down to a few hours
- Automated and manual testing of release builds is imperative in catching subtle unexpected differences between local and CI environments
We’re hoping this blog post saves some readers from this potential headache. If it does, or if you already ran into something like this yourself, we’re interested to hear your story in the comments.