Why do I get this compiler error when I use lambda

2019-07-23 07:29发布

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

0条回答
登录 后发表回答