Search code examples
javaandroidappiumappium-android

Error: discrepancies between JRE/JDK version and class file version


I am trying to test an apk file using Eclipse, Java, Selenium, Cucumber, and Appium.

In Windows Environment Variables, under System Variables, I have the value of JAVA_HOME set to "C:\Program Files\Java\jdk-15.0.2".

In Eclipse, I'm using the latest JDK 15.0.2 in my run configuration. When I execute a cucumber test, I get the following error:

C:\Users\x\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.17.4.apk'. Original error: java.lang.UnsupportedClassVersionError: com/android/apksigner/ApkSignerTool has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I'm using the latest version of JDK so why am I getting this error and how can I resolve it?


Solution

  • List of Java class file format major version numbers? shows which jdk versions use which class file versions. If you are indeed using java 15, then your jdk should recognize class files up to 59. But your error message indicates that it only recognized versions up to 52, which suggests that you're actually using java 8.