How to change java version used by cordova subprojects

后端 未结 1 973
清酒与你
清酒与你 2021-01-07 18:03

I have a Cordova project, and I am building a android plugin for it. My plugin then uses a library that uses the diamond operation (<>). I tried to run it but I receive t

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-07 18:48

    Okay, what worked for me was adding all the sub-projects(libraries) that you plugin uses as main-libraries of yout cordova project.

    Here what I did: Copy all the libraries to libs, go to eclipse>build path>order and export>Mark everything. After that, you have to create a build-extras.gradle file on your root/platforms/android folder. Put this code on your file:

    ext.postBuildExtras = {
    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
        allprojects {
            compileOptions {
                sourceCompatibility = JavaVersion.VERSION_1_7
                targetCompatibility = JavaVersion.VERSION_1_7
            }
        }
    }
    }
    

    Keeping referencing in the subprojects, though. You have to make the reference from the project and the subproject (not sure why, but worked.).

    0 讨论(0)
提交回复
热议问题