Search code examples
cordovadexinvocationtargetexceptionunsupported-class-versionphonegap-cli

Android Pre Dex: [XYZ.jar] Caused by: java.lang.UnsupportedClassVersionError: com/android/dx/command/dexer/Main


I am working on PhoneGap framework and trying to load old project of phonegap in IntelliJ 14.

When I load project, continuously getting the error :

java.lang.reflect.InvocationTargetException
.
.
.
.
.
.

Android Pre Dex: [xyz.jar] Caused by: java.lang.UnsupportedClassVersionError: com/android/dx/command/dexer/Main
.
.
.
.
.
.

I have tried with below ways :

  • Android SDK version tried with API 19 , 23 and with latest one as well
  • Have tried on MAC and Windows both
  • Project is getting compiled on the system from where it was created already
  • Project is not based on Gradle.

If someone has face this issue, then please let me know


Solution

  • I have observed through various blogs and find the answer is that,

    I need to set my java compiler version and target version 1.8 as '52.0.0' is pointing to the J2SE8. Ref from below mentioned URL : how to check the jdk version used to compile a .class file

    Changed the Java compiler version and that has worked.

    Hope so this works for the same problem.