当前位置:   article > 正文

Could not write standard input to Gradle Test Executor x.问题解决记录

could not write standard input to gradle test executor 12.

报错信息

最近系统的学了一些Kotlin进阶的东西,想在Android Studio 项目里的 unitTest写一写练练手,但是发现测试方法运行不起来,报错:

报错信息

Could not write standard input to Gradle Test Executor 1.
java.io.IOException: �ܵ����ڱ��رա�
	at java.base/java.io.FileOutputStream.writeBytes(Native Method)
	at java.base/java.io.FileOutputStream.write(FileOutputStream.java:354)
	at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
	at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
	at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:68)
	at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:53)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
	at java.base/java.lang.Thread.run(Thread.java:829)
> Task :app:testAssist_tongbuDebugUnitTest FAILED
����: �Ҳ������޷��������� worker.org.gradle.process.internal.worker.GradleWorkerMain
ԭ��: java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:testAssist_tongbuDebugUnitTest'.
> Process 'Gradle Test Executor 1' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 25s

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

报错信息看的毫无头绪,只看得出来应该是文件读写有关,网上找了相关资料,最后在stackOverflow上终于解决了

解决方法:

项目的gradle.properties 配置文件内,找到 “org.gradle.jvmargs”, 如下:

org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
  • 1

将后面的编码配置信息删除,改为如下即可:

org.gradle.jvmargs=-Xmx2048m
  • 1

-Dfile.encoding=UTF-8 这个配置我记得以前是没有的,可能是最近更新的Android Studio自动加上去的

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/942591
推荐阅读
相关标签
  

闽ICP备14008679号