gradle-retrolambda: Android Gradle Plugin 1.3.0 + Retrolambda breaks compilation of tests

Hello, we’ve updated Android Gradle Plugin to 1.3.0 (didn’t touch anything but this) and now tests with Robolectric does not compile with following error:

:app:compileRetrolambdaRobolectricDebug
:app:preRobolectricDebugUnitTestBuild UP-TO-DATE
:app:prepareRobolectricDebugUnitTestDependencies
:app:processRobolectricDebugUnitTestJavaRes
:app:compileRobolectricDebugUnitTestJavaWithJavac
An exception has occurred in the compiler (1.8.0_45). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade 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
:app:compileRobolectricDebugUnitTestJavaWithJavac FAILED

robolectric is flavor with robolectric tests.

Looks like it’s related to #23.

I can file an issue on b.android.com if it’s problem of Android Gradle Plugin.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I found my solution.

As said by @stepango at #61 I change my app.gradle file:

String java8 = getJavaVersion(8)
String java7 = getJavaVersion(7)

retrolambda {
    jdk java8
    oldJdk java7
    javaVersion JavaVersion.VERSION_1_7
//    jvmArgs '-arg1', '-arg2' < if I don't comment this line gradle fails
    defaultMethods false
    incremental true
}

String getJavaVersion(Integer v) {
    def sout = new StringBuffer()
    def proc = "/usr/libexec/java_home -v 1.$v".execute()
    proc.consumeProcessOutput(sout, new StringBuffer())
    proc.waitForOrKill(1000)
    return sout.toString().replace("\n", "").replace("\r", "")
}

Thanks again @ZeroBrain for the support.