Why do I get this compiler error when I use lambda expressions?

孤街浪徒 提交于 2019-12-13 02:26:09

问题


I recently migrated my Nougat project to Java 8 per the official instructions and replaced some OnClickListeners with lambda expressions, but I get this error when I build the apk:

An exception has occurred in the compiler (1.8.0_112). 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.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for java.lang.invoke.MethodType not found
:keyboardLib:compileDebugJavaWithJavac FAILED

I seriously doubt I found a bug in Java. More likely I'm doing something wrong. Has anyone see this error before?

I'm using Android Studio 2.2.1 (which supports lambdas) and I tried both the included JDK and also the very latest from Oracle, 1.8.0_112. My devices and emulators are all running Android 7.0 or higher.

Thanks in advance...

来源:https://stackoverflow.com/questions/40230884/why-do-i-get-this-compiler-error-when-i-use-lambda-expressions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!