How to update jdk for android cordova build

Hi,

Attempting to create Android build with Volt but having some trouble. The following error is received:

An exception has occurred in the compiler (1.8.0_312).
java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)
Build failed with an exception. * What went wrong: Execution failed for task ‘:CordovaLib:compileReleaseJavaWithJavac’.

We’ve updated our JDK version to 11 but not sure how to get the Volt build to pick up the change?

Help is appreciated.

Would you submit your job once more? I’ll set the logging to keep an eye out for this job so we can have a look at it.

(We delete jobs as soon as we are done processing them)

PS. Are you setting <engine as described here?

Hi,

Thanks for the reply. The job has been resubmitted. Yes, the engine has been set to 10.1.2 but failing to install during the build.

Got it - thank you.

Have you checked if all your plugins are up to date?

Yes, the plugins have been updated.

Can you double check? I saw at least two which were not up to date.

The next possibility is that a plugin has not been updated to the latest Java. To do that, do some builds leaving plugins out - see which one is causing the error.

Which two are you referring to? I checked last week and those that weren’t current at the time, were updated.

Good! if they are all updated, the next possibility is that a plugin has not been updated to the latest Java. To do that, do some builds leaving plugins out - see which one is causing the error.

The error received and provided in the initial post doesn’t indicate that a plugin isn’t picking up the latest Java but that the build isn’t picking up the latest Java. The target sdk (31) requires jdk 11, however jdk 8 is used for build. So, wondering how to get the build to pick up the latest Java?

Ah! I didn’t notice that. Cordova does not support SDK 31 yet - stick with SDK 30 for now.

Support for SDK should be out any day now - Cordova has completed the work and are testing it.

The move to SDK 31 was done after receiving the following build error:

The minCompileSdk (31) specified in a
dependency’s AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module’s compileSdkVersion (android-30)
Dependency: androidx.work:work-runtime:2.7.0.

Do you know which plugin is causing this? You may need to specify a lower version for it.

The new version of Cordova should be out any day now. When it is, we’ll test it ourselves, then put it into production right away.

The source of the error appears to be “androidx.work:work-runtime:2.7.0”, not a plugin.
Here’s a possible fix

Error from voltbuilder log:

Execution failed for task ‘:app:checkReleaseAarMetadata’.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
The minCompileSdk (31) specified in a
dependency’s AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module’s compileSdkVersion (android-30).
Dependency: androidx.work:work-runtime:2.7.0.
AAR metadata file: /root/.gradle/caches/transforms-3/8bdba0aef32e26b04c7a380b76c30e51/transformed/work-runtime-2.7.0/META-INF/com/android/build/gradle/aar-metadata.properties.

Are you still having this problem?

VoltBuilder doesn’t access “androidx.work:work-runtime:2.7.0” directly, but it may do so as the result of a plugin.

The error appears to stem from Gradle. A possible solution would be to fix how gradle handles this work manager. As referenced in the last post:

You can fix it by forcing Gradle to use an older version of Work Manager for the transitive dependency that works with API 30. In your build.gradle file add:

dependencies {
    def work_version = "2.6.0"
    // Force WorkManager 2.6.0 for transitive dependency
    implementation("androidx.work:work-runtime-ktx:$work_version") {
        force = true
    }
}

More info can be found here

Have you figured out which plugin is causing this?

It looks like we have a troller. Oh well, I guess you get what you pay for. Albeit, the monthly fee is small, the petty antagonism is enough to request a refund.

Yikes! I’m sorry if my responses haven’t been helpful yet. Certainly no antagonism was intended.

Internally, VoltBuilder has nothing to do directly with Gradle or androidx.work:work-runtime:2.7.0 or any of the other things you mention. These modules are all pulled in based on the plugins your project uses. That’s why I’ve asked the question whether you’ve figured out which plugin is triggering it.

We haven’t seen this issue before, so we’re trying to learn about it too.

Feel free to email me directly at ghenne@voltbuilder.com.

Trying to learn? We’ve provided links multiple times about the error not being related to a plugin, yet almost every response has been about plugins? So, one can only conclude that basic due diligence isn’t being done and the responses can be attributed to a troll.

Would you be willing to share your project with us, so we can reproduce your issue?