新闻内容

rk3399和rk3288d的android7.1签名apk报错处理

信息来源:双赞|时间:2019-11-19 16:55|浏览量:

 

rk3399和rk3288d的android7.1签名apk报错处理
签名使用到的文件路径:
 1、build/target/product/security/platform.x509.pem
 2、build/target/product/security/platform.pk8
 3、out/host/linux-x86/framework/signapk.jar
以前一直使用的  java -jar signapk.jar platform.x509.pem platform.pk8 src.apk src-sign.apk 生成src-sign.apk就是签名后的apk
在android7.1使用此方法报错:
1、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:800)
        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)
这个错误是由于java 的版本导致的,android7.1 使用的是jiava1.8 先确保java版本为:
$ java -version
openjdk version "1.8.0_141"
OpenJDK Runtime Environment (build 1.8.0_141-8u141-b15-3~14.04-b15)
OpenJDK 64-Bit Server VM (build 25.141-b15, mixed mode)
可以解决以上错误
 
2、Exception in thread "main" java.lang.UnsatisfiedLinkError: no conscrypt_openjdk_jni in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
        at java.lang.Runtime.loadLibrary0(Runtime.java:870)
        at java.lang.System.loadLibrary(System.java:1122)
        at org.conscrypt.NativeCryptoJni.init(NativeCryptoJni.java:25)
        at org.conscrypt.NativeCrypto.<clinit>(NativeCrypto.java:54)
        at org.conscrypt.OpenSSLBIOInputStream.<init>(OpenSSLBIOInputStream.java:34)
        at org.conscrypt.OpenSSLX509Certificate.fromX509PemInputStream(OpenSSLX509Certificate.java:119)
        at org.conscrypt.OpenSSLX509CertificateFactory$1.fromX509PemInputStream(OpenSSLX509CertificateFactory.java:220)
        at org.conscrypt.OpenSSLX509CertificateFactory$1.fromX509PemInputStream(OpenSSLX509CertificateFactory.java:216)
        at org.conscrypt.OpenSSLX509CertificateFactory$Parser.generateItem(OpenSSLX509CertificateFactory.java:94)
        at org.conscrypt.OpenSSLX509CertificateFactory.engineGenerateCertificate(OpenSSLX509CertificateFactory.java:272)
        at java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:339)
        at com.android.signapk.SignApk.readPublicKey(SignApk.java:182)
        at com.android.signapk.SignApk.main(SignApk.java:1087)
这个错误是由于找不到 libconscrypt_openjdk_jni.so 文件导致的。
路径:prebuilts/sdk/tools/linux/lib64/libconscrypt_openjdk_jni.so
然后运行java -Djava.library.path=. -jar signapk.jar platform.x509.pem platform.pk8 src.apk src-sign.apk  成功生成签名apk