今天项目中遇到一个问题,在网上找了一些解决方式,但是都没法解决,后来在日志中找到解决方法,查看日志的方式:gradlew compileDebug --stacktrace -info,通过日志中的> Task :app:compileDebugJavaWithJavac FAILED
Putting task artifact state for task ':app:compileDebugJavaWithJavac' into context took 0.0 secs.
file or directory 'D:\FrameDemo\app\src\debug\java', not found
Up-to-date check for task ':app:compileDebugJavaWithJavac' took 0.038 secs. It is not up-to-date because:
Task has failed previously.
All input files are considered out-of-date for incremental task ':app:compileDebugJavaWithJavac'.
Compiling with source level 1.8 and target level 1.7.
file or directory 'D:\FrameDemo\app\src\debug\java', not found
Compiling with JDK Java compiler API.
Putting task artifact state for task ':app:compileDebugJavaWithJavac' into context took 0.0 secs.
file or directory 'D:\FrameDemo\app\src\debug\java', not found
Up-to-date check for task ':app:compileDebugJavaWithJavac' took 0.038 secs. It is not up-to-date because:
Task has failed previously.
All input files are considered out-of-date for incremental task ':app:compileDebugJavaWithJavac'.
Compiling with source level 1.8 and target level 1.7.
file or directory 'D:\FrameDemo\app\src\debug\java', not found
Compiling with JDK Java compiler API.
javacTask: 源发行版 1.8 需要目标发行版 1.8
找到原因,然后File-->Project Structure-->Source Compatibility和Target Compatibility改成相同的版本,问题就解决了