ERROR: Unable to resolve dependency in android studio 3.4

I solved my problem by reverting distributionUrl in gradle-wrapper.properties

from

distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

back to

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

And also reverting gradle dependency in build.gradle from

classpath 'com.android.tools.build:gradle:3.4.0'

back to

classpath 'com.android.tools.build:gradle:3.3.2'

And now my project is fine.