Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories > hasTests[test(AVD) - 5.0] FAILED

Updated response: VM images already include fixed android-wait-for-emulator script and android SDK tools version 24.0.0 by default solving other issues.

Build Environment Updates - 2014-12-09

Brief response:

Bugged script causes your emulator don't be ready for your tests and your app is not installed due a timeout, so there are no tests performed and the build fails as a new behavior added to alert you about issues as this.


You are running on the background an outdated android-wait-for-emulator script that exits when the ADB server is running but your emulator is not fully booted (requires stopped state) (See point 7).

As your emulator is not ready and exists a two minutes INSTALL_TIMEOUT, your build fails with an InstallException caused by ShellCommandUnresponsiveException (See point 4).

You are trying to test an app running one command without --debug information, you could try my suggestion on comments and use gradle installDebug --debug and split the build (See point 2).

As you are using Travis CI build server, You need add logcat and connectedDevice logs to their output. I offer you one option that works but can be improved. Use your app module MOD_NAME=lib (See point 5).

You need manage concurrency, try to avoid create the AVD while you download/install gradle, etc. You can use install: true if you don't need it but I recommend you use it to install gradle (See point 3).

It's possible ignore this failure when you don't need test the app on an emulator or you still have no tests but Google added this feature to detect issues and I don't recommend that you disable it (See point 1).

You can disable run test from conflictive dependencies but is not your problem, ignore it now (See point 6).

I deleted points 8 and 9 about testing samples and sdcard usage because my response is too long but you use the sdcard on your lib and it's possible you need define another location for your sdcard, I don't know it.

Solving the emulator issue it's possible that sometimes you see the same error or other random issues as error core 137 (See point 10).

You can try to reload the job, change your configuration, use echo so server knows your build is not failing, use adb wait-for-device, check adb device state, increase ADB_INSTALL_TIMEOUT etc.

If you follow the other points, mainly to use another script and read the logs, I'm sure you'll detect and solve all the issues.

First response edited:

I didn't remember the real reason and you didn't share enough debug information but i solved this issue on my tests a weeks ago. I was not sure because I saved it as:

connectedAndroidTest run tests failed, (exceed
  # @-- Issue:
 (now optimize/reload job).
  # @-- 144.6 --@ Solution:
(inc. install time).

Now that i think I know the solution I add comments to my previous response:

Point 1 was a work around I used when i didn't know the reason, you don't need it now. We'll solve it.

  1. You can add this to your build.gradle on all the tested modules to ignore this failure by now.
project.gradle.taskGraph.whenReady {
    connectedAndroidTest {
        ignoreFailures = true

Point 2 was another work around that is useful for split the build and avoid the problem if you don't need test. Your real problem is about install your app on an emulator that is not ready and seems a testing issue.

  1. Or use gradle build or gradle assembleDebug assembleDebugTest.

assemble: The task to assemble the output(s) of the project

check: The task to run all the checks.

connectedCheck: Runs checks that requires a connected device or emulator.

build: This task does both assemble and check

Note that build does not depend on deviceCheck, or connectedCheck.


checks requiring a connected device are launched with the anchor task called connectedCheck.

This depends on the task androidTest and therefore will run it. This task does the following:

  • Ensure the app and the test app are built (depending on assembleDebug and assembleTest)
  • install both apps
  • run the tests
  • uninstall both apps.


Point 3 was the last point adapted to Travis Yaml case. I always override install stage so I'm not sure if they currently execute gradle assemble by default using their gradle v2.0 but the best you can do is to be sure nothing is executed without you know it and use install: true.

  1. Travis sample using ./gradlew build as the script. Or ./gradle build if you are not using gradle wrapper. Really you have gradle wrapper and use wget, i don't understand it.
  # Check install section:
  # If you'd like to skip the install stage
entirely, set it to true and nothing will be run.
  - true

  # By default Travis-ci executes './gradlew build
connectedCheck' if no 'script:' section found.
  - ./gradlew build

See Travis CI skip tests (Gradle Android project)

Point 4 is the issue/feature added by Google a weeks ago that helps that you know something is wrong. If you use --debug you can read the reason that no test are performed. An InstallException caused by ShellCommandUnresponsiveException.

When running connectedCheck and no tests are found, it should be considered a failure. This will allow detecting issue where a bad setup leads to not running any existing tests. (Xavier Ducrohet)

  1. When running connectedCheck and no tests are found, it should be considered a failure. The absence of tests is very different than having tests and not having them run. This feature is for the latter case (Jake Wharton)

See issue: 76249: Gradle should break if no tests are run

See feature: 108410: Running tests with no test found will now break the build.

Point 5 was my first "bash/yaml/ruby script" trying to find the response. Really needs be improved, I only knew that is parsed as Yaml, I used Bash manual and that is used by Ruby code. I added ' ' because looks ugly on github, i omitted it here. For line is from here

I found it, and today I have found the build with after_failure logs about this: See lines 5073, 5161, 5184

  1. You can use after_failure section to read logcat and test outputs, perhaps you find the real problem if you already have tests and the problem is another. I think an installation issue due to emulator no ready or other CI related issues. You say the app works on your personal machine.
  # - echo 'LOGCAT'   
  # Check logcat debug output:
  # Check debugging log:
  # Comment the lines belows to debug output and
redirect it to a file. Custom tags for your app.
  - adb -e logcat *:W | tee logcat.log >
/dev/null 2>&1 &

  # - echo 'FAILURE'
  # Check apt configuration:
  # Comment out the lines below to show log about
tests with app name customized on exports section.
  - sudo apt-get install -qq lynx
  - export MOD_NAME=yourappmodulename
  - export
  - lynx --dump
> myConnectedDevice.log
  - lynx --dump
${LOG_DIR} >
  - for file in *.log; do echo "$file"; echo
"====================="; cat "$file"; done || true

Point 6 I added this only for completeness but seems useful, really i didn't try it. Ignore it now.

  1. See linked response for: Disable run tests from conflictive dependencies

Point 7 I really pointed the main reason of your problem if I'm not wrong and i think the script can be improved as i tried to explain when i opened the issue about the emulator.

  1. You are using a bugged android-wait-for-emulator script, so your emulator is not ready when you begin your build. They fixed it but you are using the preinstalled outdated version. You can get the latest version using Shubham Chaudhary work around.
# Emulator Management: Create, Start
and Wait
  - echo no | android create avd --force -n test
-t android-21 --abi armeabi-v7a
  - emulator -avd test -no-skin -no-audio
-no-window &
  - curl
> android-wait-for-emulator
  - chmod u+x android-wait-for-emulator
  - ./android-wait-for-emulator
  - adb shell input keyevent 82 &

See: second response here or use my script version

I delete points 8 and 9 about tests and sdcard so I follow with the final response but you use the scard on your lib and we don't have permissions where is mounted by default.

Point 10

Issue 1: "ConnectedDevice > hasTests[] FAILED No tests found."

See issue: 76249: Gradle should break if no tests are run

See feature: 108410: Running tests with no test found will now break the build.

As debug logs show here and a Google search about it, Issue 1 changed to

Issue 2: Ddmlib is too agressive with timeouts in

See issue: 69735 -Ddmlib is too agressive with timeouts in

See feature: 112780 - ddmlib: Allow install timeout to be specified as an env variable

The names are very descriptive, can be useful, i thought it and waited for the feature but then i fixed my script and configuration issues and i dont need it. So issue 2 changes to:

Issue 3: "emulator is ready" message can be false.

See issue: 2932 - New android-wait-for-emulator script needs be fixed

See fix: New android-wait-for-emulator fixed

See alternative for custom it: Original public domain script fixed and comments

See recommended link for understand it: Starting and stopping android emulators

we are running ARM version on x86 architecture without gpu-on and limited resources, I don't know if is it currently possible enable it on an VM image but probably x86 emulator versions will work better. We need install KVM and I didnt try it on Travis build servers or know if it's possible but I did it on my computer, following this guide.

Emulator for android-21 needs more time to be ready and seems the important string was changed from not found to device not found. Travis team fixed it but the script redirects stderr to stdout and seems that adb server sends the misleading message running. They fixed it but you need the new version or an alternative as I do until VM images are updated.

If you do it and add logs to Travis output you'll see when your build has other issues as sdcard location or not. If you reload the job, it's possible that the emulator will be ready this time. You are running it on the background so it depends on what you are doing on your build. A litle change can do that Travis-ci kills a job if you don't manage the concurrency. Try to avoid downloads while the avd filesystem has been created. Remember that you use & so you are running it on a subshell and the resources are limited using a free plan. I didn't test other plans.

If you don't manage concurrency and resources, and design a good configuration script for your specific case, its's possible that sometimes your emulator is not ready, you see an error 137, you need a higher INSTALL_TIMEOUT and other random issues. You can try to reload the job and it's possible it works that time.

You can use adb wait-for-device to be sure emulator state is device before execute other heavy tasks, split the build, disable services and play with your resources. You can now use cache for public repositories if you disable sudo. I'm testing it here. I'm currently not using the cache but the container-based infrastructure seems works faster. All the jobs worked at the first time, less the 380.6 job. Issuing a ShellCommandUnresponsiveException as I think is your problem too, solved it reloading the job but probably I need improve my .travis.yml configuration file. So I looked for your issue, found my log and tried to improve this response.

I recommend you to use the original public domain script, fixed the string that changed and custom it for your case.

Categories : Android

Related to : > hasTests[test(AVD) - 5.0] FAILED
Is there a cross-feature testing, cause-effect graphing, scenario testing and usability testing in Concordion?
You can use the concordion:run command to execute active specifications from another one. This helps you to implement cross-feature testing with Concordion. You can use a SVG tool to create a cause-effect graph, if you would like to include the graph into your Concordion specifications. Moreover, Concordion allows applying the concordion:execute command on tables. Thus, you can represent the test

Categories : Misc
Importing Android Projects into Android Studio - Gradle Project Sync Failed
Ok. So. Although it seems extremely likely that it is memory related as that is what the error indicates, it was apparently more simple to fix than that. Follow these steps and see if it helps you: 1) Go to and download the newest version (Binaries only) 2) Navigate in explorer to the folder: C:Usersusername .gradlewrapperdists and extract the contents into thi

Categories : Android
Unit testing framework for my own android library
The short answer is yes. You can setup your project with robolectric & Junit4. Then, when you have tests that do not touch any Android-specific bits, you can just run them as normal JUnit tests. When you need Robolectric, you use the Robolectric test runner. The runner you use is what makes the difference. You run them all as JUnit tests anyway, so your entire library tests out with one ru

Categories : Java
How to replace the default failed img in Android's WebView
Check this code it may guide you to a solution: webView.setWebViewClient(new WebViewClient(){ @TargetApi(11) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { return super.shouldInterceptRequest(view, url); } };

Categories : Android
Add .so File To Android Studio , Execution failed
With Android Studio, you have to put your .so files inside jniLibs/(armeabi-v7a|x86|...) folder if you want them to be included inside your APK. If you have files under jni folder, Android Studio will try to compile your sources using the NDK and an auto-generated Makefile, that's certainly this task that is currently failing with your project.

Categories : Opencv
Recently Add
Wait for all requests in Android Volley
android scrollview not working
Android: How to prevent a Wifi disconnect on DHCP renewal?
Using HorizontalScrollView for gallery - no pictures inside
-bash: export: not a valid identifier
m3u8 Video stops with MediaPlayer: Error (1,-1004)
java.lang.IndexOutOfBoundsException at ListView android
Facebook REST calls for mobile cross-platform app
How to returning image from camera intent and placing in google maps api v2 as thumbnail
How can I add a row to a ListView in one Fragment by clicking the button in another Fragment?
Using MediaController on Android 5
Is TCP packet filtering possible on mobile platforms?
Spinner from editext android
Incomplete file downloaded in android using DataInputStream
How do I delete a row form SQLite DB via ListView and refresh list view?
Change action bar to toolbar, and now I am having force closes. What am I doing wrong here?
Adding buttons below GraphView, all inside a Fragment
Get rotation and display in degrees
What methods are available to execute things in the background
Data Persistence Android
Intent not delivered correctly
Android Studio 1.0 RC 1 Gradle build issues - Could not run build action using Gradle installation
otto eventbus for android behaves differently in release build
How get item ID from ListFragment in android?
Receive bluetooth connection changes after reboot
Encrypting plain-text passwords and passing variables to xml for display in android
android html5 video fullscreenchange not called on entering fullscreen
Want to create API for my android application done using Intel XDK
Gps not getting location
Spannable Text is not working in Dialog Fragment
© Copyright 2017 Publishing Limited. All rights reserved.