JNI error: while using android apksignertool

huangapple go评论90阅读模式
英文:

JNI error: while using android apksignertool

问题

I was trying to create a sample android application without using android-studio. While I tried to sign the package by $APKSIGNER sign --ks mykey.keystore bin/hello.unaligned.apk, I got the following error.

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" 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.

at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

I am using openjdk 1.8.0_265 on fedora32. Does it have something to do with jdk?

英文:

I was trying to create a sample android application without using android-studio.While I tried to sign the package by $APKSIGNER sign --ks mykey.keystore bin/hello.unaligned.apk I got the following error.

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" 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.

at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

I am using openjdk 1.8.0_265 on fedora32. Does it have something to do with jdk ?

答案1

得分: 4

Version 53.0 表示使用 Java 版本 9,而您当前的 JRE 版本是 8,无法运行 Java 9 代码。

因此,请下载并配置以使用 JRE 9。

下载链接

英文:

version 53.0 means using java version 9, and you current jre is version 8, which can not run java 9 codes.

so download and configure to use jre 9.

download link

huangapple
  • 本文由 发表于 2020年8月11日 15:03:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/63353117.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定