赞
踩
1. platform.pk8 和 platform.x509.pem
这两个文件在源码根目录的build/target/product/security/下
lzb@king:~/rk3288_7.1_mid$ cd build/target/product/security/
lzb@king:~/rk3288_7.1_mid/build/target/product/security$ ls
Android.mk media.pk8 platform.pem platform.x509.pem shared.pem shared.x509.pem testkey.pk8 verity_key verity.x509.pem
media.pem media.x509.pem platform.pk8 README shared.pk8 testkey.pem testkey.x509.pem verity.pk8
2. signapk.jar
这个文件在out/host/linux-x86/framework/下
lzb@king:~/rk3288_7.1_mid$ cd out/host/linux-x86/framework/
lzb@king:~/rk3288_7.1_mid/out/host/linux-x86/framework$ ls
ahat.jar cts-java-scanner.jar dexdeps.jar hierarchyviewer.jar jsilver.jar org-openide-util.jar
antlr-runtime.jar cts-native-scanner.jar doclava.jar hosttestlib.jar json-prebuilt.jar rmtypedefs.jar
bouncycastle-host.jar cts-tradefed.jar dumpkey.jar jarjar-apache-ant.jar junit.jar signapk.jar
compatibility-host-util.jar cts-xml-generator.jar dx.jar jarjar.jar munge-host.jar tradefed-prebuilt.jar
cts-java-scanner-doclet.jar ddmlib-prebuilt.jar guavalib.jar jarjar-maven-plugin-api.jar org-netbeans-api-visual.jar
3. 签名证书platform.pk8 和 platform.x509.pem ,签名工具signapk.jar 还有需要签名的APK放置在同一个文件夹并执行下面这条命令
lzb@king:~/rk3288_7.1_mid/certificate$ java -jar signapk.jar platform.x509.pem platform.pk8 old.apk new.apk
4. 生成的 new.apk 就是我们签名后的文件了,剩下的就是将Android签名后的APP安装在安卓手机上
在我执行完这条命令以后报错了 报错信息如下
java -jar signapk.jar platform.x509.pem platform.pk8 old.apk new.apk
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/signapk/SignApk : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: com.android.signapk.SignApk. Program will exit.
原因:jdk版本太低 笔者的sdk版本是Android 7.1,,jdk版本是jdk6,Android5.1以上的版本需要jdk7以上的版本 ,可通过下面这条命令查看当前jdk版本
echo $PATH
解决办法: 笔者jdk路径为 /usr/lib/jvm/java-7-openjdk-amd64,所以 只需要使用如下命令手动添加 JDK7 的路径进 PATH 即可
export PATH= /usr/lib/jvm/java-7-openjdk-amd64
设置完JDK路径之后,再重新执行下面命令
java -jar signapk.jar platform.x509.pem platform.pk8 old.apk new.apk
第一次写博客 写的不好多见谅!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。