RED_
RED_

Reputation: 3007

Updated gradle to 2.10 and now travis can't find my tests

I guess this is travis-ci support? I was sent here from their website. I guess I should ask the question here.

So I'm adding Google Analytics to my app, and to do that I had to update gradle to version 2.10 for their plugin. After I finished it all travis-ci ran my build, but I get the following error on every build:

com.android.builder.testing.ConnectedDevice > No tests found.[test(AVD) - 5.0.2] FAILED

This wasn't an issue when I was using gradle2.2.1.-all.

To update I changed the distributionUrl in gradle/wrapper/gradle-wrapper.properties

Anyone know a fix to this? All my other branches are fine, where I did not make this change.

For reference here is my travis.yml, I didn't change anything to it, just updated gradle.

language: android
jdk: oraclejdk7
android:
  components:
    - platform-tools
    - tools
    - build-tools-23.0.2
    - android-23
    - sys-img-armeabi-v7a-android-21
    - extra-android-support
    - extra-android-m2repository
    - extra-google-m2repository
    - extra-gooogle-google_play_services

env:
  global:
    - ADB_INSTALL_TIMEOUT=8
    - MALLOC_ARENA_MAX=2

sudo: false
cache:
  directories:
    - $HOME/.gradle/caches/2.8
    - $HOME/.gradle/caches/jars-1
    - $HOME/.gradle/daemon
    - $HOME/.gradle/native
    - $HOME/.gradle/wrapper

before_install:
  - export ANDROID_HOME=/usr/local/android-sdk
  - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
  - echo "sdk.dir=$ANDROID_HOME" > local.properties

notifications:
  slack: caketechnologies:pnmNEHM1ZxudlMZNTv6oVgcT

install:
  - TERM=dumb ./gradlew -s assembleDemoDebug

before_script:
  # Create and start emulator
  - echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
  - emulator -avd test -no-skin -no-audio -no-window &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &

script:
  - ./gradlew connectedAndroidTest -PdisablePreDex --stacktrace

Upvotes: 3

Views: 966

Answers (3)

David Bernard
David Bernard

Reputation: 1640

As an alternative, use gradle wrapper (aka gradlew). Travis use gradlew if available.

Chapter 5. The Gradle Wrapper

Upvotes: 0

Nevin Chen
Nevin Chen

Reputation: 1815

This is my .travis.yml file. Download gradle 2.10 before you start the build since it's not in Travis yet.

language: android
jdk:
    - oraclejdk8
env:
  matrix:
    - ANDROID_TARGET=android-21 ANDROID_ABI=armeabi-v7a
  global:
    - ADB_INSTALL_TIMEOUT=8
android:
  components:
    - build-tools-23.0.3
    - android-23
    - add-on
    - extra
    - sys-img-armeabi-v7a-android-21
before_script:
    - wget http://services.gradle.org/distributions/gradle-2.10-bin.zip
    - unzip gradle-2.10-bin.zip
    - export GRADLE_HOME=$PWD/gradle-2.10
    - export PATH=$GRADLE_HOME/bin:$PATH

Hope it helps.

Upvotes: 5

albodelu
albodelu

Reputation: 7971

these suggestions don't solve the issue, ignore this response

You are using android gradle plugin 1.5 but you updated yesterday google play services plugin to 2.0.0.x to support google-services.json for different productFlavors. They updated both from 1.5 to 2.0.0.x here. I would try to also update android gradle plugin to 2.0.0.x like here:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-beta6'
        classpath 'com.google.gms:google-services:2.0.0-beta6'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Last update: I'm not using this plugin version, perhaps updating gradle plugin versions to 2.0.0.X like here solves the issue.

Google just included support for flavors on version 2.0 of the play services plugin. Since this version of the gradle plugin com.google.gms:google-services:2.0.0-alpha3

And without the PATH changes on Travis-ci, I tried it one time, and they already export their default location, I'm not sure now, but it was an issue for me, and I added new location at the beginning.

Update:

Due this answer doesn't solve the issue, extra suggestions:

  • Is your local build working after adding 2.10? Google-services plugin config
  • Build ./gradlew build connectedCheck -PdisablePreDex --debug
  • Update Android Gradle plugin version
  • I suggest adding more info --debug so you can read the real reason
  • Change skin
  • Use ./gradlew clean assemble -PdisablePreDex
  • Add the new exports to the beginning of the PATH, so are found before the default

First answer:

Perhaps you need clearing-caches or change this line:

- $HOME/.gradle/caches/2.8

by

- $HOME/.gradle/caches/

I guess you should comment out the next lines to discard caching related issues:

sudo: false
cache:
  directories:
    - $HOME/.gradle/caches/2.8
    - $HOME/.gradle/caches/jars-1
    - $HOME/.gradle/daemon
    - $HOME/.gradle/native
    - $HOME/.gradle/wrapper

Upvotes: 0

Related Questions