赞
踩
最近系统的学了一些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自动加上去的
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。