uber-apk-signer icon indicating copy to clipboard operation
uber-apk-signer copied to clipboard

class file has wrong version 55.0, should be 53.0

Open Morsmalleo opened this issue 2 years ago • 9 comments

Keep getting this error everytime I run ./mvnw clean install, the error arises with both Java 1.8.0_252 and Java 11.0.3 for Kali Linux , done some research and can't seem to find a solution.

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/kali/uber-apk-signer/src/main/java/at/favre/tools/apksigner/ui/MultiKeystoreParser.java:[6,24] cannot access java.util.stream.Collectors
bad class file: /modules/java.base/java/util/stream/Collectors.class
class file has wrong version 55.0, should be 53.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.585 s
[INFO] Finished at: 2021-11-09T04:54:32-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project uber-apk-signer: Compilation failure
[ERROR] /home/kali/uber-apk-signer/src/main/java/at/favre/tools/apksigner/ui/MultiKeystoreParser.java:[6,24] cannot access java.util.stream.Collectors
[ERROR]   bad class file: /modules/java.base/java/util/stream/Collectors.class
[ERROR]     class file has wrong version 55.0, should be 53.0
[ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Morsmalleo avatar Nov 09 '21 10:11 Morsmalleo

Class file version 53 is Java 9 and version 55 is java 11 - are you sure you set Maven to use the desired java version and not just java home?

Try to run ./mvnw -version to see which java version it uses. Mine is

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Users\****\.m2\wrapper\dists\apache-maven-3.6.3-bin\1iopthnavndlasol9gbrbg6bf2\apache-maven-3.6.3
Java version: 1.8.0_202, vendor: AdoptOpenJdk, runtime: C:\Program Files\AdoptOpenJDK\jdk-8.0.202.08\jre
Default locale: de_AT, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

and compiles fine.

patrickfav avatar Nov 13 '21 08:11 patrickfav

Ah so that's what the problem could be, I will run the command in the terminal and print the output

Morsmalleo avatar Nov 13 '21 08:11 Morsmalleo

OK so I ran ./mvnw -version in a terminal and this was the output

Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/kali/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
Java version: 11.0.13, vendor: Debian, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.10.0-kali9-amd64", arch: "amd64", family: "unix"

I switched to Java 1.8.0_252 provided by the Debian Stretch software repositories and ran the same command and it gave me the same output.

Morsmalleo avatar Nov 13 '21 08:11 Morsmalleo

Any solution on this problem? I am running into same thing on my gradle project.

LynnLiu301 avatar Feb 23 '22 05:02 LynnLiu301

Any solution on this problem? I am running into same thing on my gradle project.

Nothing so far bro, been waiting for a while, not sure what's happening

Morsmalleo avatar Feb 26 '22 04:02 Morsmalleo

Any solution on this problem? I am running into same thing on my gradle project.

Nothing so far bro, been waiting for a while, not sure what's happening

I sort of encountered a similar issue today and I have managed to solve it with help from multiple sources from the internet. I learned that the issue is that some class files were compiled using Java X while others were compiled using Java Y.

  1. Your first approach is to confirm the linked Java version of your mvn. mvn -v
  2. Then confirm which Java version you are using for both your computer and application.
  3. If they don't match, feel free to set a JAVA_HOME variable for your desired Java version. echo export "JAVA_HOME=\$(/usr/libexec/java_home -v 17)" >> ~/.bash_profile && source ~/.bash_profile
  4. After that, do a maven build of your application. mvn clean install

ShemBrooklyne avatar Oct 13 '22 15:10 ShemBrooklyne

Thanks I'll give this a try

Morsmalleo avatar Oct 13 '22 15:10 Morsmalleo

Because the library classes that you're using at the moment are decompiled by Java 11, not different verison of Java. When I check some parent class from some library, it updated by Java version. I mean classes are changing depends on Java version. So you need to match library classes that you use and Java version.

keunoh avatar Dec 14 '22 06:12 keunoh

Because the library classes that you're using at the moment are decompiled by Java 11, not different verison of Java. When I check some parent class from some library, it updated by Java version. I mean classes are changing depends on Java version. So you need to match library classes that you use and Java version.

I didn't think Java 9 had an installation candidate because that's what class file 53 is, it's java 9

Morsmalleo avatar Dec 14 '22 06:12 Morsmalleo