The biggest problems I have encountered with this type of situations are caused by the coordinate that contains the version with which the dependency is being verified, I recommend that you look for the most recent version that is compatible with the project, sometimes when you look for this dependency it may not be available com.android.tools.build:gradle:x.x.x and sometimes the functionality is not what you require, so you have to increase the version number.