我在this question中找到了一些帮助。因此,我知道我必须使用JDK7才能进行单元测试。.因此,我想到了一个构建清单,如下所示:

buildscript
{
    repositories
    {
        jcenter()
    }

    dependencies
    {
        classpath 'org.javafxports:jfxmobile-plugin:1.0.8'
    }
}

retrolambda.oldjdk = 'C:/Program Files/Java/jdk1.7.0_79'

apply plugin: 'org.javafxports.jfxmobile'
apply plugin: 'java'

sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

repositories {
    jcenter()
}

dependencies
{
    testCompile 'junit:junit:4.12'
}

mainClassName = 'AppMain'

jfxmobile
{
    javafxportsVersion = '8.60.7'
    android
    {
        applicationPackage = 'com.somename.someapplication'
        androidSdk = 'C:/Program Files (x86)/Android/android-sdk' //
    }
}


但是我不断收到这个异常:

Could not get unknown property 'retrolambda' for root project


关于如何解决此问题的任何想法?

最佳答案

您必须先应用jfxmobile插件,这反过来会添加retrolambda依赖项。然后,您可以配置retrolambda oldJdk变量。
(请注意camelCase的拼写)

buildscript
{
    repositories
    {
        jcenter()
    }

    dependencies
    {
        classpath 'org.javafxports:jfxmobile-plugin:1.0.8'
    }
}

apply plugin: 'org.javafxports.jfxmobile'
apply plugin: 'java'

retrolambda.oldJdk = 'C:/Program Files/Java/jdk1.7.0_79'

10-02 06:27