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

报错信息

最近系统的学了一些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

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

解决方法:

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

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

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

org.gradle.jvmargs=-Xmx2048m

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

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值