当前位置:   article > 正文

Android 安卓Could not write standard input to Gradle Test Executor x.初次运行时发现问题_:app:testdebugunittest --tests "com.example.myappl

:app:testdebugunittest --tests "com.example.myapplication.exampleunittest"'.

Android 安卓Could not write standard input to Gradle Test Executor x.初次运行时发现问题

运行状况

软件初次运行,发现测试类运行不成功

在这里插入图片描述

报错内容

Executing tasks: [:app:testDebugUnitTest] in project E:\Android\MyApplications\HelloWorld


> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig
> Task :app:javaPreCompileDebug
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:checkDebugAarMetadata
> Task :app:packageDebugResources
> Task :app:mergeDebugResources
> Task :app:mapDebugSourceSetPaths
> Task :app:createDebugCompatibleScreenManifests
> Task :app:extractDeepLinksDebug
> Task :app:parseDebugLocalResources
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest
> Task :app:preDebugUnitTestBuild UP-TO-DATE
> Task :app:javaPreCompileDebugUnitTest
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:processDebugUnitTestJavaRes NO-SOURCE
> Task :app:processDebugManifestForPackage
> Task :app:processDebugResources
> Task :app:compileDebugJavaWithJavac
> Task :app:bundleDebugClassesToRuntimeJar
> Task :app:bundleDebugClassesToCompileJar
> Task :app:compileDebugUnitTestJavaWithJavac
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:61)
	at java.base/java.lang.Thread.run(Thread.java:829)
> Task :app:testDebugUnitTest 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:testDebugUnitTest'.
> 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
BUILD FAILED in 7s
20 actionable tasks: 20 executed
10:06:40: Task execution finished ':app:testDebugUnitTest --tests "com.example.helloworld.ExampleUnitTest.addition_isCorrect"'.

  • 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
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60

查看原因

此时打开File选择Settings,如下图
在这里插入图片描述

在Settings内搜索gradle,此时可以看到gradle的默认路径是C:\Users\sh’mi’l’y.gradle。

在这里插入图片描述

我们的.gradle文件路径内出现了gradle不可解析的字符 ‘’

解决思路

因此,找到C:\Users\sh’mi’l’y.gradle的文件,将其复制,移动到想要的地方即可。

在这里插入图片描述

如果运行程序时出现E:.gradle\daemon\7.3.3\registry.bin (拒绝访问。)问题。

  • 可先关闭Android Studio,找到.gradle文件夹删除即可, 当重新启动Android
    Studio时,它将下载gradle原数据。构建成功。
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/942594
推荐阅读
相关标签
  

闽ICP备14008679号