How to fix message in Android Studio 4.2 to remove jcenter() and migrate to mavenCentral()

Android Studio 4.2 displays below message.
Please remove usages of jcenter() Maven repository from your build scripts and migrate your build to other Maven repositories. This repository is deprecated and it will be shut down in the future.

To fix it, open the gradle file at the project level, search and and replace jcenter() with mavenCentral().

Although code will compile without changing jcenter() to mavenCentral() a of now, from February 2022, jcenter() will no more work. Therefore, the change needs to be done in all gradle files now.