Platform: RK3399
OS: Android 7.1
Kernel: v4.4.83
现象:
编译OTA diff包:
./build/tools/releasetools/ota_from_target_files -v -i rk3399_mid-target_files-v1.zip
-p out/host/linux-x86 -k build/target/product/security/testkey
rk3399_mid-target_files-v2.zip out/target/product/rk3188/rk3399_mid-v1-v2.zip
提示如下error log:
running: openssl pkcs8 -in build/target/product/security/testkey.pk8 -inform DER -nocrypt
running: java -Xmx2048m -Djava.library.path=out/host/linux-x86/lib64 -jar out/host/linux-x86/framework/signapk.jar -w build/target/product/security/testkey.x509.pem build/target/product/security/testkey.pk8 /tmp/tmp2DzjKE out/target/product/rk3188/rk3399_mid-v1-v2.zip
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/signapk/SignApk : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
ERROR: signapk.jar failed: return code 1
原因:
java和javac版本不一致
javac:
kris@build--machine:/rk3399$ javac -version javac 1.8.0_45-internal
java:
kris@build--machine:/rk3399$ java -version java version "1.7.0_111" OpenJDK Runtime Environment (IcedTea 2.6.7) (7u111-2.6.7-0ubuntu0.14.04.3) OpenJDK 64-Bit Server VM (build 24.111-b01, mixed mode)
解决方法:
java版本选择1.8.0_45
root@build--machine:/home/kris/rk3399# update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1069 manual mode
参考:
Exception in thread “main” java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0) [duplicate]
原作者:KrisFei
|