0

I'm having a problem building a cordova app for android sdk 31, the error i get is:

java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)

My cordova config:

<preference name="android-targetSdkVersion" value="31" />
        <preference name="android-minSdkVersion" value="29" />
        <preference name="android-compileSdkVersion " value="31" />
        <preference name="AndroidXEnabled" value="true" />
        <preference name="GradlePluginKotlinVersion" value="1.5.32" />
        <preference name="android-buildToolsVersion" value="31.0.0" />

From things i've read it seems with this version of the sdk i need to be using JDK 11, and looking up how to change the version everything says to do this in android studio under: Build, Execution, Deployment > Build Tools > Gradle -> Gradle JDK

But i don't have that option in android studio!

I have studio: Android Studio Electric Eel | 2022.1.1 Patch 2 which was built in Feb 2023, this is all i see...

enter image description here

noname
  • 153
  • 2
  • 12

1 Answers1

0

From things i've read it seems with this version of the sdk i need to be using JDK 11

If you need to be using JDK 11, then that needs to be the installed Java version on your computer. With a terminal open at the root directory of your Cordova application, you should be able to enter the command java -version and have the result be something along the lines of openjdk version "11.0.11" 2021-04-20.

This answer describes how to install Java 17. In your case, you just need to modify the commands slightly to install Java 11.

wubbalubba
  • 535
  • 2
  • 15