当前位置:网站首页>APK签名流程介绍[通俗易懂]
APK签名流程介绍[通俗易懂]
2022-07-01 17:47:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
实际上,现在Android开发IDE自带签名功能,但是有时我们还是可能遇到自己签名apk的场景的,比如你有一个未签名的apk,但是你要adb install到device上,这时我们在adb install之前就必须对该apk进行签名处理才能install成功,这篇文章就简单的介绍下apk签名流程吧。
1、生成签名证书
签名需要签名证书,签名证书类型实际上是有很多的,如jks、keystore等,这里以生成keystore为例来生成一个yjing.keystore签名证书文件。
本文利用JDK 下的keytool工具来生成keystore文件,相信配置好Android开发环境的童鞋应该都不会遇到keytool工具找不到的问题,这里直接使用命令
keytool -genkey -alias keyAlias -keyalg RSA -validity 20000 -keystore yjing.keystore
以上命令各参数含义如下:
-genkey 生成文件
-alias 别名
-keyalg 加密算法
-validity 有效期(天)
-keystore 文件名
就这样,我们生成了一个yjing.keystore的签名文件,实际上在签名过程中需要填写一些基本信息,这个随便填填就行了,然后在签名成功后会发现有如下提示
可以看到keytool工具现在已经推荐使用JKS的签名证书了,这个不管,反正我们已经拿到yjing.keystore了(我生成的yjing.keystore文件在C://users/对应用户名下)。
2、对apk进行签名
对apk签名还是利用JDK下的jarsigner工具来进行,我们通过如下命令来签名
jarsigner -verbose -keystore yjing.keystore -signedjar signed.apk unsigned.apk keyAlias
这里也说说参数吧 -verbose 输出签名的详细信息
-keystore 密钥库位置 后面跟签名证书文件路径
-signedjar 表示进行签名操作
signed.apk 生成的签名文件(不是当前路径时,需添加路径)
unsigned.apk 表示未签名文件
yjing.keystore 签名证书文件
keyAlias 生成签名时候的别名
通过以上命令也就能成功生成签名apk文件signed.apk了
参考文献
1、手把手,教你怎样用命令行给apk签名 2、生成签名证书keystore
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/130888.html原文链接:https://javaforall.cn
边栏推荐
- 网上股票开户安全吗?是否可靠?
- In depth evaluation and development trend prediction report of China's ice cream market (2022 Edition)
- From comedians to NBA Zhan Huang, check the encrypted advertisements during this super bowl
- 中国一次性卫生用品生产设备行业深度调研报告(2022版)
- DNS
- 整形数组合并【JS】
- Pyqt5, draw a histogram on the control
- Development cost of smart factory management system software platform
- (16) ADC conversion experiment
- RadHat搭建内网YUM源服务器
猜你喜欢
Replace UUID, nanoid is faster and safer!
Rotation order and universal lock of unity panel
Cassette helicopter and alternating electric field magnetic manometer DPC
荣威 RX5 的「多一点」产品策略
ACM mm 2022 video understanding challenge video classification track champion autox team technology sharing
Cookies and session keeping technology
Yyds dry inventory MySQL RC transaction isolation level implementation
字节跳动数据平台技术揭秘:基于 ClickHouse 的复杂查询实现与优化
Leetcode records - sort -215, 347, 451, 75
New patent applications and transfers
随机推荐
Mysql database - Advanced SQL statement (2)
The new server is packaged with the source code of H5 mall with an operation level value of several thousand
MySQL + JSON = King fried
Blackwich: the roadmap of decarbonization is the first step to realize the equitable energy transformation in Asia
Code example of libcurl download file
Research Report on China's enzyme Market Forecast and investment strategy (2022 Edition)
SLO is increasingly used to achieve observability | Devops
Redis -- data type and operation
[mathematical modeling] [matlab] implementation of two-dimensional rectangular packing code
PHP implements sensitive word filtering system "suggestions collection"
Key points on February 15, 2022
整形数组合并【JS】
String的trim()和substring()详解
LeetCode中等题之TinyURL 的加密与解密
[Verilog quick start of Niuke network question brushing series] ~ priority encoder circuit ①
About selenium element positioning being overwritten
线上开通ETF基金账户安全吗?有哪些步骤?
Wechat applet blind box - docking wechat payment
Cassette helicopter and alternating electric field magnetic manometer DPC
The reviewboard has 500 errors when submitting a review. Solutions