0

I have one application in android, i changed one library but it is showing the next error when i try to compile it

Task :app:transformClassesWithDynatraceTransformerForColombiaDebug FAILED Execution failed for task ':app:transformClassesWithDynatraceTransformerForColombiaDebug'. com.dynatrace.tools.android.InstrumentationException: Unable to instrument class com.co.demo.sdk.android.webview.WebViewException$Companion because it was compiled with a higher Java version than the one used for this build. Please adapt your JRE accordingly to https://www.dynatrace.com/support/help/shortlink/dynatrace-android-gradle-plugin-overview#requirements

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

My java version is

Test@Local Dummy % java -version openjdk version "11.0.14.1" 2022-02-08 LTS OpenJDK Runtime Environment Corretto-11.0.14.10.1 (build 11.0.14.1+10-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.14.10.1 (build 11.0.14.1+10-LTS, mixed mode)

The full error is

Caused by: java.lang.UnsupportedClassVersionError: com/co/sdk/android/test/exception/BackendException has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Caused by: java.lang.UnsupportedClassVersionError: com/co/sdk/android/test/exception/BackendException has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at com.dynatrace.android.instrumentation.transform.instrumentor.InstructionInstrumentor.transformMethod(InstructionInstrumentor.java:77) at com.dynatrace.android.instrumentation.transform.DefaultSubTransformer.transformMethod(DefaultSubTransformer.java:77) at com.dynatrace.android.instrumentation.Instrumentor.transform0(Instrumentor.java:150) at com.dynatrace.android.instrumentation.Instrumentor.instrument(Instrumentor.java:104) at com.dynatrace.tools.android.transformation.InstrumentedBuild.transformContent(InstrumentedBuild.java:75) ... 134 more

Alejandro Gonzalez
  • 1,221
  • 4
  • 15
  • 30
  • 3
    Java is backward compatible but not forward compatible. You can't embed a library compiled in Java X and run the code with Java X-1 since there is no guarantee that the JRE X-1 understands the bytecode produced by the JRE X (while the other way round is always guaranteed) – Matteo NNZ Aug 20 '22 at 16:37
  • @MatteoNNZ which is the solution in this case ? – Alejandro Gonzalez Aug 20 '22 at 16:42
  • To use a version of the library which is compatible with your JDK. External libraries usually provide a table of compatibilities (for example version xxx is compatible with JDK 11, version yyy with JDK 16 and so on) – Matteo NNZ Aug 20 '22 at 16:43
  • [java 11 is version 55](https://stackoverflow.com/a/11432195/950837), so my guess is somehow java 8 is getting picked up in your environment. – éclairevoyant Aug 20 '22 at 18:38

0 Answers0