I ran into a similar problem in Android studio because it also uses gradle, so my problem was that the source code of the application was written in the old version of gradle, but I have the latest Android studio with the latest gradle. therefore, the dependency of the class on the latest version of gradle has changed
Update path class dependency in build.gradle file at project level from
dependencies { classpath 'com.android.tools.build:gradle:1.2.3'
before
dependencies { classpath 'com.android.tools.build:gradle:2.1.0'
source share