Error Analysis:
The failure message says that the gradle dependency resolution failed while locating the debug build classes, the task name is app:debugCompileClasspath. In this case the classes for the dependency com.squareup.leakcanary:leakcanary-android:1.5.4 is not found.
Possibilities:
a) No Internet availability to reach the online repos.
b) Could not locate the repositories.
The failure message says that the app:debugCompileClasspath task is failing when looking for the com.squareup.leakcanary:leakcanary-android:1.5.4 (jar or AAR).
Gradle allows you to define the repositories at the the root project level or at project level
allProjects{
repositories {
maven() //Gradle has the definition that points to https://jcenter.bintray.com/
}
}
So it will look into the following places for the class files or jar file.
Name: $ANDROID_HOME/extras/m2repository; url: file://$ANDROID_HOME/extras/m2repository/
Name: $ANDROID_HOME/extras/google/m2repository; url: file://$ANDROID_HOME/extras/google/m2repository/
Name: $ANDROID_HOME/extras/android/m2repository; url: file://$ANDROID_HOME/extras/android/m2repository/
Name: BintrayJCenter; url: https://jcenter.bintray.com/
If not found the dependency resolution will fail giving the error mentioned above.
How to Fix:
1) Ensure the internet availability.
2) Ensure the online repository site is up and running
3) Ensure that the the correct repository url is listed in the build.gradle file such as
allProjects{
repositories {
maven() //Gradle has the definition that points to https://jcenter.bintray.com/
maven {
url "maven.google.com" //Google Maven Repo
}
}
}
* What went wrong: Could not resolve all files for configuration ':app:debugCompileClasspath'. > Could not find com.squareup.leakcanary:leakcanary-android:1.5.4.