Android 报错:Execution failed for task ‘:app:compileDebugJavaWithJavac‘

Posted 胡刚2021

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android 报错:Execution failed for task ‘:app:compileDebugJavaWithJavac‘相关的知识,希望对你有一定的参考价值。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Failed to query the value of task ':app:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
   > Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, D:\\RtmpBiBili\\app\\build\\generated\\ap_generated_sources\\debug\\out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@7ae973c8) before task ':app:compileDebugJavaWithJavac' has completed is not supported

* 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.

原因是 android studio配置的 jdk版本 和 gradle版本不对导致的
1.修改jdk版本



2.配置jdk的路径
此路径下面要有jdk的bin文件夹

3.修改gradle版本为7.0.1

4.将项目clean 重新build即可

以上是关于Android 报错:Execution failed for task ‘:app:compileDebugJavaWithJavac‘的主要内容,如果未能解决你的问题,请参考以下文章

Android打包apk报错:Execution failed for task ‘:app:lintVitalRelease‘.

Android打包apk报错:Execution failed for task ‘:app:lintVitalRelease‘.

Android Studio build报错 Error:Execution failed for task ':XXXX:processDebugGoogleServices'.

错误记录Android Studio 编译报错 ( Execution failed for task ‘:APP_MIDI:lintVitalRelease‘. )

错误记录Android Studio 编译报错 ( Execution failed for task ‘:APP_MIDI:lintVitalRelease‘. )

错误记录Android Studio 编译报错 ( Execution failed for task ‘:app:kaptDebugKotlin‘. A failure occurred w )