导入NotNull或Nullable,Android Studio将无法编译
2022-08-31 13:27:15
当我向参数添加@NotNull或@Nullable注释时,Android Studio 会自动帮助我添加 /lib/注释.jar和导入
import org.jetbrains.annotations.NotNull
import org.jetbrains.annotations.Nullable;
但在此之后,项目将无法编译。如果我也删除了注释,但保留了导入语句,项目仍然无法编译。但是,如果我删除NotNull和Nullable的导入语句,项目编译良好!
Android Studio 给出了一个一般性错误:
Gradle:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Bugtester:compileDebug'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
从 cmd 运行给出了一个轻微的提示:gradlew compileDebug
:Bugtester:compileDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Bugtester:compileDebug'.
> Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
所以我检查了我的环境变量,它们被设置为:
JAVA_HOME=C:\Program Files (x86)\Java\jre7
JDK_HOME=C:\Program Files\Java\jdk1.7.0_21\
有人对此有任何想法吗?(我是Java和Android编程的新手)