Execution failed for task :app:testDebugUnitTest in Android studio - android

Suddenly build failed in my project and try to run assemble from gradle option Android studio below error log showinng
TaskExecutionException: Execution failed for task ':app:testDebugUnitTest'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:207)
.....
Caused by: org.gradle.process.internal.ExecException: Process 'Gradle Test Executor 1' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:417)
Any help would be great.

Try to see if you gradle.properties is proper configured and if the line of jvm arguments is not commented.
gradle.properties image
When this line is commented or when the parameter -Xmx2048m is with a low value, you will have out of JVM memory error that is the root cause of app:testDebugUnitTest failure.

Related

Jenkins mergeDebugResources FAILED - no access to files

I would like to run espresso tests on jenkins. I did configuration like here
https://www.perfectomobile.com/solutions/devtunnel/espresso-in-continuous-integration
I got error like below
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-
1.1\design-26.1.0.aar\a1a21cd8aba52bd546711d26a970dfcb\res\drawable-
v21\avd_hide_password.xml: error: file not found.
Error: java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --
debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
10 actionable tasks: 9 executed, 1 up-to-date
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
Any sugestions what can be wrong?
This is happening because AAPT2 still has issues with long paths on windows (only supports paths up to 145 characters or so for now, sadly). This file path is around 170, so it's over that limit.
The issue should be fixed soon, in the meantime you can move your cache directory closer to the C: root.
I faced the same issue. The solution proposed here helped.
Simply add enviornmental variable GRADLE_USER_HOME
env GRADLE_USER_HOME= ${WORKSPACE}/gh
Note: Make sure gh is close to the main drive location

Android gradle build fails suddenly on ':app:mergeDebugResources' with no error messages

My gradle build stopped working completely out of the blue. Minute earlier it worked fine. Didn't change anything in gradle config files; as a matter of fact I was only changing application style in XML.
Make, clean and run produce:
Execution failed for task ':app:mergeDebugResources'.
> -1
Running gradle with --stacktrace produces:
Executing task ':app:mergeDebugResources' (up-to-date check took 0.031 secs) due to:
Task ':app:mergeDebugResources' class path has changed from 35ff0c585719dc5a2e2e4d58900e722a to 01ad85243d44a7018a6f6b671ff7bf6b.
All input files are considered out-of-date for incremental task ':app:mergeDebugResources'.
Unable do incremental execution: full task run :app:mergeDebugResources FAILED :app:mergeDebugResources
(Thread[Task worker for ':',5,main]) completed.
Took 0.155 secs.
Removing build directory didn't help, as well as cache invalidation and restart. Any ideas?
Using Canary (3.0) with build tools version 26.0.0.
Update #1
Running with --info --debug hints:
could not find method google() for arguments [] on repository container.
However, removing google() from config yields:
Received result
Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project '[project name]'.] from daemon DaemonInfo{pid=3686, address=[e01105f7-0954-4e44-b561-3ac18fc3194f port:35854, addresses:[/0:0:0:0:0:0:0:1%lo, /127.0.0.1]], idle=true, lastBusy=1499443736429, context=DefaultDaemonContext[uid=64f95479-4418-4e3d-948b-7481648b65df,javaHome=/usr/lib/jvm/java-8-openjdk-amd64,daemonRegistryDir=/home/iwoherka/.gradle/daemon,pid=3686,idleTimeout=10800000,daemonOpts=-Xmx1536m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done).
18:09:26.648 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Finished
18:09:26.649 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: connection stop
Well, it turned out that the problem was fonts in res directory instead of main which caused gradle to act very weird.

angular2 cordova android failing to run in emulator

I setup a basic angular2 app in cordova, it runs fine in iOS but with android I'm getting build failed with an exception, I can run android fine in a basic cordova app.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/24.0.2/aapt'' finished with non-zero exit value 1
Error: /Users/username/Code/workshop/cordova/angular-2/MyApp/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
ok i resolved the issue which was caused by node_modules folder being too heavy for the emulator to launch, i cut a lot of fat from node_modules (i.e deleted dependencies and other fluff that wasn't needed) and increased the resources available to the avd.
things ran smooth after that :)

phonegap build fail : Execution failed for task ':processDebugResources'

When trying to build my app
phonegap local build android
I have this issue :
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/xxxxxxxx/Library/Android/sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
I have no idea of how to resolve this, since this problem is mostly encoutered by people developing their app in java.
Thanks in advance for your answers
I had same issue. It turned out to be that I had bad (or missed) some icon/splash-screen images (ie: platforms/android/res/drawable-hdpi etc) and other images.
You can check that runnning './gradlew --debug clean build' from your platforms/android directory. Search in the log for the ':processDebugResources FAILED' string and close to it the file-name that caused the problem. In my case it was 'año nuevo.png' (the 'ñ' caused the issue)
If that doesn't work, have a look at these other SO-questions, they may help too:
ionic build android failure - Execution failed for task processDebugResources
Cordova build android error Execution failed for task ':processDebugResources'
Android Studio build failed at "processDebugResources" when using 9-patch images
PS: Im using latest phonegap (6.3.0) and latest Android Studio (2.1.2)

Android NDK configuration: Execution failed for task

Same issue as NDK is not configured issue in android studio. I added the path to the properties file and then got the error message. Then I added an empty test.c to the jni folder under app/src/main/jni, as well as app/src/main/jni/jni, but the error is till there.
Error:Execution failed for task ':app:compileDebugNdk'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Richard Jiang\AppData\Local\Android\android-ndk-r10e\ndk-build.cmd'' finished with non-zero exit value 1
I went to the android-ndk-r10e and there is a file called ndk-build.cmd, so I really don't know how to solve the issue.
There is a space in your ndk path, I guess that's what make he call to ndk-build.cmd fail. Try to move it somewhere else.
Else you should be able to get a more explicit error from the "Messages" tab from Android Studio.

Categories

Resources