:app:compile xxxxx JavaWithJavac FAILED
An exception has occurred in the compiler (1.8.0_312). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)
at com.sun.tools.javac.util.Assert.error(Assert.java:133)
at com.sun.tools.javac.code.TypeAnnotations.annotationType(TypeAnnotations.java:231)
at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:294)
at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1066)
...
問題發生原因:
Android Studio Arctic Fox 中更新 gradle jdk 的路徑有問題
Arctic Fox 會使 JDK 1.8 無法正常工作
解決辦法:
更新 Android Studio
並設定 gradle 路徑
改成 JDK 11 點擊 OK 即可生效。
Windows:
File> Project structure> SDK Location>Gradle Settings
Mac:
Android Studio > Preferences > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK
沒有留言:
張貼留言