The branch was previously functional, then merged to master and the builds on master failed. Master was reverted, then master was merged into this branch and some fixes were made. When attempting to merge back to master, the build failed again with the following error. The push passed, the pr failed.
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.squareup.leakcanary:leakcanary-android:1.5.4.
The travis.yml file:
sudo: false
language: android
android:
components:
- build-tools-27.0.2
- android-27
- sys-img-armeabi-v7a-android-27
jdk:
- oraclejdk8
before_install:
- yes | sdkmanager "platforms;android-27"
- chmod +x gradlew
#First app is built then unit tests are run
jobs:
include:
- stage: build
  async: true
  script: ./gradlew assemble
- stage: test
  async: true
  script: ./gradlew -w runUnitTests
  notifications:
  email:
  recipients:
  - [email protected]
  on_success: always # default: change
  on_failure: always # default: always 
 
                        
I felt maven repo outage today and faced the same issue. Hours later, I found that the failed Travis Job is working fine now. Do check it at your side.
Also, For any given scenario when classpath dependencies are missing one should check the
build.gradlefile rather than the.travis.ymlfile.The failure message says that the
app:debugCompileClasspathtask is failing when looking for thecom.squareup.leakcanary:leakcanary-android:1.5.4(jar or AAR). Gradle allows you to define the repositories at the the root levelallProjects{ repositories { maven() //Gradle has definition the 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: $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.