Gradle commands fail on API 23 Google API emulator image (armeabi-v7a)

I can’t seem to get Gradle commands from the command line to work with the API 23 Google API emulator image (Google APIs ARM (armeabi-v7a)) – I always get a

Steps to reproduce:

  • TextInputLayout has no effect for giving hint programatically in EditText
  • import android.R in Eclipse : Why?
  • webChromeClient opens link in browser
  • how to merge to two bitmap one over another
  • Google Play Services for Android. Location client not update location if wifi disabled
  • TextView ellipsize and broken symbols
    1. Create an AVD with API 23 Google APIs ARM (armeabi-v7a)
    2. Clone (or use your own project)
    3. Run gradlew installDebug from the command line

    You’ll see:

    :demo:installDebug FAILED

    FAILURE: Build failed with an exception.

    • What went wrong:

    Execution failed for task ‘:demo:installDebug’.

    If you run gradlew connectedCheck you’ll see a similar error:

    • What went wrong:
      Execution failed for task ‘:library:connectedDebugAndroidTest’.

    I can install/run the project and tests from Android Studio (1.4) without any problems.

    Gradle commands seem to run fine on the API 21 Google API emulator image from the command line.

    Here is an example failure on Travis for API 23 Google API emulator image:

    …and an example successful build when using the API 21 Google API emulator image:

    The only difference between the two builds is the Google API emulator API level of 23 vs. 21:


    I’ve opened an AOSP issue here on this problem:

    Related posts:

    Android: bitmap.getByteCount() in API lesser than 12
    Square LeakCanary Cannot find symbol
    How to retrieve and modify HTML content from WebView with Http Post
    Changing number of columns with GridLayoutManager and RecyclerView
    How can I use Eclipse's new Xtend language in my Android project?
    How to implement a simple REST and ContentProvider architecture using Models?
  • Gradle error : Could not find
  • Espresso match first element found when many are in hierarchy
  • Android action bar not showing overflow
  • Fragments Incompatible types
  • AccessToken token:ACCESS_TOKEN_REMOVED in Facebook Android SDK
  • Dagger for Android: Injecting an Activity to the object graph after calling setContentView
  • One Solution collect form web for “Gradle commands fail on API 23 Google API emulator image (armeabi-v7a)”

    Short answer

    Android Gradle Plugin had a hardcoded timeout value that was too low.

    Google fixed it in version 2.0.0-beta3:

    Will be in 2.0.0-beta3.

    So what do we put in build.gradle to set this timeout value?

    Currently it’s all attached to android.adbOptions.timeOutInMs.

    Sample: Google project Increasing ADB timeout and adding Travis-ci support. It works!.

    Previous response

    It’s the same issue that has been reported here

    Read the workaround from the unity3 developer about the hardcoded and low timeout here

    and star the issue

    You are right. It’s not a Travis-ci issue, to reproduce it, you only need to create an armeabi-v7a emulator and try to install any app locally from gradle command.

    Further information here, the update3 of my answer


    You can avoid the installVariant tasks and this issue using adb:

    ./gradlew clean
    ./gradlew assembleDebug
    ./gradlew assembleDebugAndroidTest
    adb install app/build/outputs/apk/app-debug.apk
    adb install app/build/outputs/apk/app-debug-androidTest-unaligned.apk
    adb shell am instrument -w

    It works:

    Total time: 19.787 secs
    2413 KB/s (4204090 bytes in 1.701s)
        pkg: /data/local/tmp/app-debug.apk
    1984 KB/s (1058902 bytes in 0.521s)
        pkg: /data/local/tmp/app-debug-androidTest-unaligned.apk
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.