twilio / twilio-chat-demo-android

Chat API Demo Application for Android
MIT License
62 stars 51 forks source link

Build Failing on CI with twilio sdk #143

Closed rooparsh closed 4 years ago

rooparsh commented 4 years ago

Description

Android Build Failing on Circle CI because of Twilio Chat Sdk

We are unable to build android app on Circle Ci because of daemon disappearing every time we use twilio chat sdk. Without it, we are able to do it.

Every time we use twilio sdk , we receive daemon disappeared unexpectedly error. We tried using 4gb heap size on circle ci, tried caching resources but still no luck.

Code

We are using this gradle command clean app:assembleRelease -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false

Reproduces how Often

Everytime we use Twilio Chat SDK

Logs

log file: /home/circleci/.gradle/daemon/6.1.1/daemon-964.out.log
----- Last  20 lines from daemon log file - daemon-964.out.log -----
2020-07-30T06:19:49.519+0000 [DEBUG] [org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler] Starting executing command: Build{id=645f56d8-a857-4493-895a-bd91052193ab, currentDir=/home/circleci/tkn} with connection: socket connection from /127.0.0.1:36455 to /127.0.0.1:48188.
2020-07-30T06:19:49.520+0000 [ERROR] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] Command execution: started DaemonCommandExecution[command = Build{id=645f56d8-a857-4493-895a-bd91052193ab, currentDir=/home/circleci/tkn}, connection = DefaultDaemonConnection: socket connection from /127.0.0.1:36455 to /127.0.0.1:48188] after 0.0 minutes of idle
2020-07-30T06:19:49.520+0000 [INFO] [org.gradle.launcher.daemon.server.DaemonRegistryUpdater] Marking the daemon as busy, address: [7fdf8db5-53d1-4eb5-98a3-1bc7647f4cf7 port:36455, addresses:[localhost/127.0.0.1]]
2020-07-30T06:19:49.520+0000 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Marking busy by address: [7fdf8db5-53d1-4eb5-98a3-1bc7647f4cf7 port:36455, addresses:[localhost/127.0.0.1]]
2020-07-30T06:19:49.520+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
2020-07-30T06:19:49.520+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2020-07-30T06:19:49.521+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2020-07-30T06:19:49.521+0000 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] resetting idle timer
2020-07-30T06:19:49.521+0000 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] daemon is running. Sleeping until state changes.
2020-07-30T06:19:49.521+0000 [INFO] [org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy] Daemon is about to start building Build{id=645f56d8-a857-4493-895a-bd91052193ab, currentDir=/home/circleci/tkn}. Dispatching build started information...
2020-07-30T06:19:49.521+0000 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 19: dispatching org.gradle.launcher.daemon.protocol.BuildStarted@c62bdc8
2020-07-30T06:19:49.521+0000 [DEBUG] [org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment] Configuring env variables: {PATH=/home/circleci/tkn/vendor/bundle/ruby/2.6.0/bin:/opt/android/sdk/emulator:/opt/android/sdk/tools:/opt/android/sdk/tools/bin:/opt/android/sdk/platform-tools:/home/circleci/.rubies/ruby-2.6.1/bin:/home/circleci/.local/bin:/home/circleci/bin:/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, BUNDLER_ORIG_RUBYLIB=BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL, NO_PROXY=127.0.0.1,localhost,circleci-internal-outer-build-agent, BUNDLER_ORIG_GEM_HOME=BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL, CIRCLE_WORKFLOW_WORKSPACE_ID=ca405cd3-f1a9-428b-905d-10211a568745, CIRCLE_PREVIOUS_BUILD_NUM=272, BUNDLER_ORIG_BUNDLE_GEMFILE=BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL, FASTLANE_PLATFORM_NAME=android, NODE_VERSION=12.18.3, ANDROID_HOME=/opt/android/sdk, BUNDLE_BIN_PATH=/home/circleci/.rubies/ruby-2.6.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle, BUNDLER_ORIG_MANPATH=BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL, CIRCLE_WORKING_DIRECTORY=~/tkn, CIRCLE_INTERNAL_TASK_DATA=/.circleci-task-data, PWD=/home/circleci/tkn, BUNDLER_ORIG_RB_USER_INSTALL=BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL, SLACK_URL=*******************************************************************************, BASH_ENV=/tmp/.bash_env-5f2265eede0ee15cac5dbc8c-0-build, CIRCLE_BUILD_NUM=273, CIRCLE_SHA1=44cb1dbba583c3f30d61d53ed85b89e4b25e4938, OLDPWD=/home/circleci/tkn, GEM_HOME=/home/circleci/tkn/vendor/bundle/ruby/2.6.0, CIRCLE_NODE_INDEX=0, ADB_INSTALL_TIMEOUT=120, CIRCLE_NODE_TOTAL=1, DEBIAN_FRONTEND=noninteractive, BUNDLER_VERSION=1.17.2, _JAVA_OPTIONS=-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap, YARN_VERSION=1.22.4, BUNDLE_GEMFILE=/home/circleci/tkn/Gemfile, BUNDLER_ORIG_BUNDLER_VERSION=BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL, CIRCLE_SHELL_ENV=/tmp/.bash_env-5f2265eede0ee15cac5dbc8c-0-build, SHLVL=0, BUNDLER_ORIG_PATH=/opt/android/sdk/emulator:/opt/android/sdk/tools:/opt/android/sdk/tools/bin:/opt/android/sdk/platform-tools:/home/circleci/.rubies/ruby-2.6.1/bin:/home/circleci/.local/bin:/home/circleci/bin:/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, BUNDLER_ORIG_GEM_PATH=BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL, JAVA_HOME=/usr/local/openjdk-8, CIRCLE_COMPARE_URL=https://bitbucket.org/rooparsh/testProject-android/branches/compare/44cb1dbba583c3f30d61d53ed85b89e4b25e4938..c4b228a27b598a5df70f7f4bcce953934d363f59, CIRCLE_PROJECT_USERNAME=rooparsh, LANG=C.UTF-8, CIRCLE_STAGE=build, CIRCLE_INTERNAL_SCRATCH=/tmp/circleci-179870283, CIRCLE_BUILD_URL=https://circleci.com/bb/rooparsh-hyd/testProject-android/273, CIRCLE_WORKFLOW_UPSTREAM_JOB_IDS=, CIRCLE_BRANCH=fix/ci, BUNDLER_ORIG_BUNDLE_BIN_PATH=BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL, BUNDLER_ORIG_RUBYOPT=BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL, SLACK_WEBHOOK=*******************************************************************************, BUNDLER_ORIG_BUNDLER_ORIG_MANPATH=BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL, JAVA_VERSION=8u262, RUBYLIB=/home/circleci/.rubies/ruby-2.6.1/lib/ruby/2.6.0, _=/home/circleci/.rubies/ruby-2.6.1/bin/bundle, CIRCLECI=true, ,, CI=true, CIRCLE_JOB=build, CIRCLE_WORKFLOW_ID=ca405cd3-f1a9-428b-905d-10211a568745, RUBYOPT=-rbundler/setup, SSH_AUTH_SOCK=/tmp/circleci-179870283/ssh_auth_sock, CIRCLE_INTERNAL_CONFIG=/.circleci-runner-config.json, GEM_PATH=, HOSTNAME=f312ae13ed0a, FASTLANE_LANE_NAME=fast, CIRCLE_WORKFLOW_JOB_ID=d889da50-feb4-43a4-a0ab-034741d8c8d9, HOME=/home/circleci}
2020-07-30T06:19:49.522+0000 [DEBUG] [org.gradle.launcher.daemon.server.exec.LogToClient] About to start relaying all logs to the client via the connection.
2020-07-30T06:19:49.522+0000 [INFO] [org.gradle.launcher.daemon.server.exec.LogToClient] The client will now receive all logging from the daemon (pid: 964). The daemon log file: /home/circleci/.gradle/daemon/6.1.1/daemon-964.out.log
2020-07-30T06:19:49.522+0000 [INFO] [org.gradle.launcher.daemon.server.exec.LogAndCheckHealth] Starting 2nd build in daemon [uptime: 1 mins 10.848 secs, performance: 100%]
2020-07-30T06:19:49.523+0000 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has started executing the build.
2020-07-30T06:19:49.523+0000 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] Executing build with daemon context: DefaultDaemonContext[uid=fe0b1d7b-5db2-4a60-b352-5151f69bdc41,javaHome=/usr/local/openjdk-8,daemonRegistryDir=/home/circleci/.gradle/daemon,pid=964,idleTimeout=10800000,priority=NORMAL,daemonOpts=-Xmx4096m,-Dfile.encoding=UTF-8,-Duser.country,-Duser.language=en,-Duser.variant]
WARNING: [Processor] Library '/home/circleci/.gradle/caches/modules-2/files-2.1/com.giphy.sdk/ui/1.2.8/3aeb37c7716c5c9712ae122a8063d62b3869ab21/ui-1.2.8.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
 Example of androidX reference: 'androidx/lifecycle/MutableLiveData'
 Example of support library reference: 'android/support/annotation/VisibleForTesting'
----- End of the daemon log -----

FAILURE: Build failed with an exception.

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

Or attach it as a file.

Versions

All relevant version information for issue.

Chat Android SDK

6.0.0

Android API

23-29

oianmol commented 4 years ago

Same issue here @rooparsh , Let me know if you are able to fix this.

prudhvir3ddy commented 4 years ago

@rooparsh facing the same. tried a lot. @berkus please help.

rusmonster commented 4 years ago

Hi! Please try add the following line in your project's gradle.properties:

org.gradle.jvmargs=-XX:-UseGCOverheadLimit -Xmx1536m

Let me know if it helps. @rooparsh @Anmol92verma @prudhvir3ddy

rooparsh commented 4 years ago

@rusmonster Still failing. Though this time error is more verbose.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:lintVitalDevRelease'.
> Could not resolve all artifacts for configuration ':app:qaDebugCompileClasspath'.
   > Failed to transform chat-android-with-symbols-6.0.0.aar (com.twilio:chat-android-with-symbols:6.0.0) to match attributes {artifactType=android-manifest, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api}.
      > Execution failed for JetifyTransform: /home/circleci/.gradle/caches/modules-2/files-2.1/com.twilio/chat-android-with-symbols/6.0.0/709638113c08f38288496219d348f65966aa87ab/chat-android-with-symbols-6.0.0.aar.
         > Java heap space
rusmonster commented 4 years ago

@rooparsh what resource_class do you use in circleci executor?

btw what's versions of gradle and android gradle plugin do you use?

rusmonster commented 4 years ago

@rooparsh also gradle probably takes less memory for sdk version WITHOUT symbols. So better to use it for build on CI in case if you don't upload symbols from CI.

rooparsh commented 4 years ago

@rusmonster even with 4096m its failing.

Gradle Plugin : 4.0.0 Gradle : 6.1.1

we are currently using this sdk com.twilio:chat-android-with-symbols:${Versions.LibVersion.TWILIO}

rooparsh commented 4 years ago

@rusmonster Thanks for the suggestion. This dependency worked.

com.twilio:chat-android:6.0.0