Android studio gradle HeapDumpOnOutOfMemoryError - linux

My problem
I recently install android studio in Ubuntu 14.
But I have problem in gradle build execution.
gradle not completed for any project even hello world project
What I am tried
1.
File Menu - > Invalidate Caches/ Restart..
2.Increase the heap size manually using this answer
3.Android Studio Gradle loading
But no luck for me.
Error details
Tooling API is using target Gradle version: 2.4.
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Starting daemon process: workingDir = /home/knonex19/.gradle/daemon/2.4, daemonArgs: [/usr/lib/jvm/java-8-oracle/bin/java, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -Duser.country=IN, -Duser.language=en, -Duser.variant, -cp, /home/knonex19/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4/lib/gradle-launcher-2.4.jar, org.gradle.launcher.daemon.bootstrap.GradleDaemon, 2.4, /home/knonex19/.gradle, /home/knonex19/.gradle/daemon, 10800000, 3a17e311-fb84-4407-a62b-c87d02683ab5, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -Duser.country=IN, -Duser.language=en, -Duser.variant]
Starting process 'Gradle build daemon'. Working directory: /home/knonex19/.gradle/daemon/2.4 Command: /usr/lib/jvm/java-8-oracle/bin/java -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=IN -Duser.language=en -Duser.variant -cp /home/knonex19/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4/lib/gradle-launcher-2.4.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 2.4 /home/knonex19/.gradle /home/knonex19/.gradle/daemon 10800000 3a17e311-fb84-4407-a62b-c87d02683ab5 -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=IN -Duser.language=en -Duser.variant
Successfully started process 'Gradle build daemon'
An attempt to start the daemon took 0.902 secs.
Connected to daemon DaemonInfo{pid=2796, address=[ec70070e-7a08-4520-a3ae-0c0b751449aa port:38689, addresses:[/0:0:0:0:0:0:0:1%lo, /127.0.0.1]], idle=false, context=DefaultDaemonContext[uid=3a17e311-fb84-4407-a62b-c87d02683ab5,javaHome=/usr/lib/jvm/java-8-oracle,daemonRegistryDir=/home/knonex19/.gradle/daemon,pid=2796,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=IN,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=9fe736cb-042e-4d0f-a55b-f95626396a77.1, currentDir=/home/knonex19/Desktop/tummyfulltabletpos}.
[ 351800] WARN - ConfigurableExtensionPointUtil - Can't find parent for project.propCompiler (Compiler)
Anybody solve my issue thanks..

Related

SonarQube: Error: Could not create the Java Virtual Machine

I'm new to SonarQube, When i run "C:\sonarqube-8.5.1.38104\bin\windows-x86-64\StartSonar.bat", i receives below error,
--> Wrapper Started as Console
Launching a JVM...
Picked up _JAVA_OPTIONS: -Xmx1024M
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
2020.11.16 13:40:45 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory C:\sonarqube-8.5.1.38104\temp
2020.11.16 13:40:45 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.11.16 13:40:45 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [C:\sonarqube-8.5.1.38104\elasticsearch]: C:\Program Files\Java\jdk-15.0.1\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=C:\sonarqube-8.5.1.38104\temp -XX:ErrorFile=../logs/es_hs_err_pid%p.log -Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=C:\sonarqube-8.5.1.38104\elasticsearch -Des.path.conf=C:\sonarqube-8.5.1.38104\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch
2020.11.16 13:40:45 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
Picked up _JAVA_OPTIONS: -Xmx1024M
Unrecognized VM option 'UseConcMarkSweepGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
2020.11.16 13:40:46 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
2020.11.16 13:40:46 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2020.11.16 13:40:46 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
FATAL StatusLogger Interrupted before Log4j Providers could be loaded.
java.lang.InterruptedException
at java.base/java.util.concurrent.locks.ReentrantLock$Sync.lockInterruptibly(ReentrantLock.java:159)
at java.base/java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:372)
at org.apache.logging.log4j.util.ProviderUtil.lazyInit(ProviderUtil.java:121)
at org.apache.logging.log4j.util.ProviderUtil.hasProviders(ProviderUtil.java:108)
at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:89)
at org.elasticsearch.common.unit.ByteSizeValue.<clinit>(ByteSizeValue.java:39)
at org.elasticsearch.common.network.NetworkService.<clinit>(NetworkService.java:57)
at org.elasticsearch.transport.TransportSettings.<clinit>(TransportSettings.java:74)
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:105)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:135)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:277)
at org.sonar.application.es.EsConnectorImpl$MinimalTransportClient.<init>(EsConnectorImpl.java:103)
at org.sonar.application.es.EsConnectorImpl.buildTransportClient(EsConnectorImpl.java:89)
at org.sonar.application.es.EsConnectorImpl.getTransportClient(EsConnectorImpl.java:74)
at org.sonar.application.es.EsConnectorImpl.getClusterHealthStatus(EsConnectorImpl.java:61)
at org.sonar.application.process.EsManagedProcess.checkStatus(EsManagedProcess.java:88)
at org.sonar.application.process.EsManagedProcess.checkOperational(EsManagedProcess.java:73)
at org.sonar.application.process.EsManagedProcess.isOperational(EsManagedProcess.java:58)
at org.sonar.application.process.ManagedProcessHandler.refreshState(ManagedProcessHandler.java:220)
at org.sonar.application.process.ManagedProcessHandler$EventWatcher.run(ManagedProcessHandler.java:285)
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
<-- Wrapper Stopped
Please help me here...
Thanks in advance.
Your problem most likely occurs due to the fact that you are attempting to run SonarQube with an unsupported Java version.
From the error log, I presume that you are attempting to run it using either Java 14 or Java 15 based on these lines:
Picked up _JAVA_OPTIONS: -Xmx1024M
Unrecognized VM option 'UseConcMarkSweepGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
The CMS collector was deprecated in Java 9 and removed altogether in Java 14:
https://openjdk.java.net/jeps/363
This means that the batch script that attempts to start Sonar is passing in some JVM args that are no longer valid.
Based on their documentation that only supported Java version are 8 and 11
https://docs.sonarqube.org/latest/requirements/requirements/
and version above those are not supported:
SonarQube scanners require version 8 or 11 of the JVM and the
SonarQube server requires version 11. Versions beyond Java 11 are not
officially supported.
I suggest you attempt to run it using the correct Java version. Also please check the related documentation beforehand to avoid such issues.

The Intellij IDEA does not launch after editing the VM options file

In Intellij IDEA 2019 I mistakenly added incorrect lines to the VM option file (Menu | Help | Edit Custom VM Options). After that, the IDEA does not launch. Reinstallation didn't help. When I run IDEA from terminal, it gives the following error:
~/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/193.7288.26/bin$ ./idea.sh
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated
in version 9.0 and will likely be removed in a future release.
Error: Could not find or load main class org.gradle.jvmargs=-Xmx2048M,
-XX:MaxMetaspaceSize=512m Caused by: java.lang.ClassNotFoundException:
org.gradle.jvmargs=-Xmx2048M, -XX:MaxMetaspaceSize=512m
But at the same time, these lines are not in the idea64.vmoptions file:
~/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/193.7288.26/bin$ cat idea64.vmoptions
-Xms128m
-Xmx750m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djava.net.preferIPv4Stack=true
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
-Dawt.useSystemAAFontSettings=lcd
-Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
-Dsun.tools.attach.tmp.only=true
I don't understand what the error is. Can anyone help? Thanks for any comment/answer!
Delete/edit the custom .vmoptions file.
Usually it's located in the IDE configuration directory.
On Linux look for
~/.config/JetBrains/IntelliJIdea2020.2/idea64.vmoptions (for 2020.2 Ultimate)
~/.IntelliJIdea2019.3/config/idea64.vmoptions (2019.3 Ultimate)
~/.IdeaIC2019.3/config/idea64.vmoptions (2019.3 Community)
Toolbox managed installations may use different location:
~/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/193.7288.26.vmoptions

Logstash not loading config pipeline on startup

I installed the ELK (version 5.6 elastic / logstash / kibana) stack on a CentOS 7 (using version 5.6) box using the rpm method, and have services enabled to run on startup. I verify it is running after reboot like so:
ps aux | grep logstash
logstash 744 4.6 2.2 3381144 363308 ? SNsl 09:06 0:48 /usr/bin/java -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+DisableExplicitGC -Djava.awt.headless=true -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError -Xmx1g -Xms256m -Xss2048k -Djffi.boot.library.path=/usr/share/logstash/vendor/jruby/lib/jni -Xbootclasspath/a:/usr/share/logstash/vendor/jruby/lib/jruby.jar -classpath : -Djruby.home=/usr/share/logstash/vendor/jruby -Djruby.lib=/usr/share/logstash/vendor/jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main /usr/share/logstash/lib/bootstrap/environment.rb logstash/runner.rb --path.settings /etc/logstash
I don't see anything in that process command regarding my pipeline configurations. In my settings file, I have path.config : /etc/logstash/conf.d/*.conf.
This is modified from the default path.config : /etc/logstash/conf.d/ which according to the documentation does the exact same thing (and I've tried both).
The 3 files I have are valid, as I can ingest data manually using:
/usr/share/logstash/bin/logstash -f '/etc/logstash/conf.d/{fileA,fileB,fileC}.conf' (or I can run them individually).
I want these ingestion pipelines to start when my server reboots, but I believe I have my configurations set correctly. I even re-ran the system-install script for good measure. Any ideas?
I ended up manually changing the systemd config for logstash by going to /etc/systemd/system/logstash.service and changing:
ExecStart=/usr/share/logstash/bin/logstash "--path.settings" "/etc/logstash"
to:
ExecStart=/usr/share/logstash/bin/logstash "--path.settings" "/etc/logstash" "-f" "/etc/logstash/conf.d/{fileA,fileB,fileC}.conf"
After rebooting, I discovered the process was indeed loading these pipelines.

Elasticsearch error to start service

I have problems starting elasticsearch, the command to start is:
cd /etc/init.d && ./elasticsearch start
Out put.
/opt/jdk1.8.0_77 uno
JAVA /opt/jdk1.8.0_77/bin/java
Starting elasticsearch: [ OK ]
but executed status I get: "elasticsearch dead but subsys locked"
I tried deleting "elasticsearch", in /var/lock/subsys but, this file is generated again.
In the log says.
java.lang.RuntimeException: Java version: 1.7.0_40 suffers from critical bug https://bugs.openjdk.java.net/browse/JDK-8024830 which can cause data corruption.
Please upgrade the JVM, see http://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html for current recommendations.
If you absolutely cannot upgrade, please add -XX:-UseSuperWord to the JVM_OPTS environment variable.
Upgrading is preferred, this workaround will result in degraded performance.
But the process is started with java 8,
elasticsearch 26918 0.8 1.0 30526952 724324 ? Sl Jul03 1:29 /opt/jdk1.8.0_77/bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Delasticsearch -Des.foreground=yes -Des.path.home=/opt/elasticsearch -cp :/opt/elasticsearch/lib/elasticsearch-1.7.0.jar:/opt/elasticsearch/lib/*:/opt/elasticsearch/lib/sigar/* org.elasticsearch.bootstrap.Elasticsearch
Any help would be appreciated.
Verify java selection
alternatives --config java
Make sure java 8 is in use. Elasticsearch requires at least Java 8.
Please try setting up the variables in /etc/elasticsearch/elasticsearch.yml:
path.data: path/to/data
path.work: path/to/work
path.logs: /var/log/elasticsearch
path.conf: /etc/elasticsearch
Note: Give access to user "elasticsearch" for folder that
elasticsearch uses:
chown -R elasticsearch /path/to/data
chown -R elasticsearch /path/to/work

Gradle robolectric project works on OSX computer but not on Linux

I'm using the same version of Gradle, 1.7 jdk thus not exactly the same version.
The main complain of the testing is :
java.lang.NoClassDefFoundError:
org/apache/maven/artifact/ant/DependenciesTask Caused by:
java.lang.ClassNotFoundException:
org.apache.maven.artifact.ant.DependenciesTask
I've tried to clean gradle cache in order to re download all dependencies.
Also i've tried to clean the project.
This didn't work.
What variables can affect the execution of a gradle test ?
To me there is:
Gradle itself
Java version of the sdk
Internet connections problems
What else can be interfering ? Are plugin versions platform dependant ?
Executing task ':robolectric-tests:test' (up-to-date check took 0.432 secs) due to:
Output file /home/ec2-user/repositories/MyProject/robolectric-tests/build/test-results has changed.
Output file /home/ec2-user/repositories/MyProject/robolectric-tests/build/reports/tests has changed.
Output file /home/ec2-user/repositories/MyProject/robolectric-tests/build/test-results/binary/test has changed.
Starting process 'Gradle Test Executor 1'. Working directory: /home/ec2-user/repositories/MyProject/robolectric-tests Command: /usr/java/jdk1.7.0_72/bin/java -Djava.security.manager=jarjar.org.gradle.process.internal.child.BootstrapSecurityManager -Dfile.encoding=UTF-8 -Duser.country=ES -Duser.language=ca -Duser.variant -ea -cp /home/ec2-user/.gradle/caches/2.3/workerMain/gradle-worker.jar jarjar.org.gradle.process.internal.launcher.GradleWorkerMain 'Gradle Test Executor 1'
Successfully started process 'Gradle Test Executor 1'
Gradle Test Executor 1 started executing tests.
Gradle Test Executor 1 finished executing tests.
com.tubtale.MyProject.robolectrictests.tests.RobTMyAndroidClassTest > testWhenActivityCreatedHelloTextViewIsVisible2 FAILED
java.lang.NoClassDefFoundError: org/apache/maven/artifact/ant/DependenciesTask
Caused by:
java.lang.ClassNotFoundException: org.apache.maven.artifact.ant.DependenciesTask
com.tubtale.MyProject.robolectrictests.tests.RobTMyAndroidClassTest > testWhenActivityCreatedHelloTextViewIsVisible FAILED
java.lang.NoClassDefFoundError: org/apache/maven/artifact/ant/DependenciesTask
2 tests completed, 2 failed
Finished generating test XML results (0.217 secs) into: /home/ec2-user/repositories/MyProject/robolectric-tests/build/test-results
Generating HTML test report...
Finished generating test html results (0.11 secs) into: /home/ec2-user/repositories/MyProject/robolectric-tests/build/reports/tests
:robolectric-tests:test FAILED
:robolectric-tests:test (Thread[main,5,main]) completed. Took 4.005 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':robolectric-tests:test'.
> There were failing tests. See the report at: file:///home/ec2-user/repositories/MyProject/robolectric-tests/build/reports/tests/index.html
* Try:
Run with --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':robolectric-tests:test'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:306)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:169)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: org.gradle.api.GradleException: There were failing tests. See the report at: file:///home/ec2-user/repositories/MyProject/robolectric-tests/build/reports/tests/index.html
at org.gradle.api.tasks.testing.Test.handleTestFailures(Test.java:1118)
at org.gradle.api.tasks.testing.Test.executeTests(Test.java:549)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 44 more
BUILD FAILED
I also ran into this issue on Linux but not OSX. I found a work-around by adding
org.apache.maven:maven-ant-tasks:2.1.3
to my 'testCompile' dependencies.
dependencies {
repositories {
mavenCentral()
}
testCompile 'junit:junit:4.12'
testCompile 'org.apache.maven:maven-ant-tasks:2.1.3'
testCompile 'org.robolectric:robolectric:2.4'
testCompile 'org.mockito:mockito-all:1.9.5'
}
I don't know why maven-ant-tasks isn't getting fetched on linux. It appears to be a valid dependency of robolectric.
The selected answer is correct, and also applies when upgrading Gradle from 2.2.1 to 2.3 on OSX. If you don't add the dependency for testCompile 'org.apache.maven:maven-ant-tasks:2.1.3' then Robolectric tests will fail when the Gradle version is 2.3.
Also noteworthy is that I have a separate module for my Robolectric tests, so I added the new dependency to the build.gradle file in my Robolectric module, NOT my Android app module.
Just got a new Mac, so my old Mac & new Mac are side by side, while I configure the new one. I used Homebrew to build up my new Mac, and wasn't aware that Gradle 2.3 had just been released... That's why the Robolectric tests worked on my old Mac (with Gradle 2.2.1) but not on my new Mac (with Gradle 2.3).

Resources