Android Migration to Circleci 2

Hallo everyone, i dont know why this error. can anyone help me.

FAILURE: Build failed with an exception.

  • What went wrong:
    Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

  • Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Exception is:
    org.gradle.launcher.daemon.client.DaemonDisappearedException: Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
    at org.gradle.launcher.daemon.client.DaemonClient.handleDaemonDisappearance(DaemonClient.java:238)
    at org.gradle.launcher.daemon.client.DaemonClient.monitorBuild(DaemonClient.java:214)
    at org.gradle.launcher.daemon.client.DaemonClient.executeBuild(DaemonClient.java:178)
    at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:141)
    at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:92)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:291)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:264)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:33)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:257)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:191)
    at org.gradle.launcher.Main.doAction(Main.java:33)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

  • Get more help at https://help.gradle.org
    Exited with code 1

I don’t know, but if I were debugging this I would:

  • Run a failing build with the SSH option and get a console
  • Re-run the tests and investigate as if the problem was a local one (and with the initial assumption that it is nothing to do with CI)
  • Search for “Gradle build daemon disappeared unexpectedly” on the web to see what the problem might be
  • Try --info or --debug as the error recommends
  • Look at dmesg to see if it ran out of memory. You have a 4G RAM limitation, if you are using a standard Docker container

how to try --info or --debug? can you give me recomendation link

I would guess man gradle would answer that question. Try adding either of these flags to your existing gradle command?

It is worth noting that there is no documentation for every bug and problem in CI. To debug CI issues, you need to persist on your own, and with a search engine to hand for an hour or two, prior to asking a question. Where you ask a question, you may find that your readers would need to sit at your terminal and do the debugging for you, and thus it is much better for you to do it.

With this in mind, when I suggested a number of things to try, my hope is that you tried all of them, thoroughly, prior to replying. My worry is that you replied immediately without trying anything at all. My most helpful advice is: try to be self-sufficient as much as you can, because it’s the only way to learn. :slightly_smiling_face:

Good luck!

1 Like

Could you please copy your config.yml? I would like to understand exactly what you are doing.
Your Gradle error looks somewhat familiar to me. I may have seen it in my Jenkins Android CI log in the past.

Also, please let us know if this gradle daemon issue is happening intermittently.

1 Like
version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-25-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
      - run:
          name: Download Dependencies
          command: ./gradlew androidDependencies
      - run:
          name: Setup emulator
          command: sdkmanager "system-images;android-21;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-21;default;armeabi-v7a"
      - run:
          name: Launch emulator
          command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on
          background: true
      - run:
          name: Wait Emulator
          command: circle-android wait-for-boot
      - save_cache:
          paths:
            - ~/.gradleqqwzs
          key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
      - run:
          name: Run Tests
          command: ./gradlew app:connectedVerifyDebugAndroidTest --stacktrace -PdisablePreDex --console=plain
          timeout: 120000
      - store_artifacts:
          path: app/build/reports
          destination: reports
      - store_test_results:
          path: app/build/test-results

this my config.yml
https://pastebin.com/9mfr2j2J

Is it correct that this is an intermittent issue?

If it is indeed disappearing unexpectedly intermittently, that sounds like a memory issue. Docker has a 4G memory limit, and we regularly see issues with android/gradle builds exceeding memory.

You will certainly want to disable predexing, although I think Circle may do this automatically. You can also add some GRADLE_OPTS to your environment section when spinning up the image:

environment:
    GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
1 Like

yes, i got the issue

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.