android - Gradle task taking over 4 minutes (for 20-second test suite) - Stack Overflow

When launching my test suite from the command line:.gradlew "connectedDebugAndroidTest"ther

When launching my test suite from the command line:

./gradlew "connectedDebugAndroidTest"

there is a task that is taking more than 4 minutes, even if no changes have been made:

> :app:processDebugAndroidTestManifest > Resolve dependencies of :app:debugAndroidTestRuntimeClasspath > espresso-core-$project.espressoVersion.pom

It only takes 20 seconds to run the entire test suite, and maybe 10 seconds to compile. During this 4-minute task, there is only one java process on the machine, and it is consuming less than 0.01% cpu (according to top).

Is this task necessary? It doesn't appear to be doing anything. Is there a way to simply remove it from the build, or skip it?

When launching my test suite from the command line:

./gradlew "connectedDebugAndroidTest"

there is a task that is taking more than 4 minutes, even if no changes have been made:

> :app:processDebugAndroidTestManifest > Resolve dependencies of :app:debugAndroidTestRuntimeClasspath > espresso-core-$project.espressoVersion.pom

It only takes 20 seconds to run the entire test suite, and maybe 10 seconds to compile. During this 4-minute task, there is only one java process on the machine, and it is consuming less than 0.01% cpu (according to top).

Is this task necessary? It doesn't appear to be doing anything. Is there a way to simply remove it from the build, or skip it?

Share Improve this question edited Jan 11 at 12:49 Andrew T. 4,7078 gold badges46 silver badges68 bronze badges asked Jan 11 at 11:31 Byron HawkinsByron Hawkins 2,7052 gold badges28 silver badges36 bronze badges 2
  • 1 If you are using Espresso, Gradle needs Espresso and its dependencies. Since that task does not normally take minutes, you might want to investigate further for why it is taking Gradle that long. For example, perhaps there is a networking issue that is causing abnormally long response times when looking up artifacts in some specific Maven repository. – CommonsWare Commented Jan 11 at 13:42
  • @CommonsWare that fixed it. My development machine has problems with the wifi, but if I share my phone's internet over usb, suddenly that task takes much less than a second. Seems like kind of an extreme timeout setting though. – Byron Hawkins Commented Jan 11 at 14:27
Add a comment  | 

1 Answer 1

Reset to default 1

Gradle wants to check on the status of dependencies on each build by default. Your specific line is for Espresso, which (presumably) you are using in your tests.

Since you are using ./gradlew, you could try adding --offline to your command to tell Gradle to always work purely from cache. If you add dependencies or change dependency versions, though, you will need to run at least once without that switch.

You could also try playing with Gradle timeout settings, though usually that's a solution for increasing the timeout rather than decreasing it.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743399830a4462510.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信