当前位置:网站首页>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
边栏推荐
- DRF --- response rewrite
- [Verilog quick start of Niuke network question brushing series] ~ priority encoder circuit ①
- Cassette helicopter and alternating electric field magnetic manometer DPC
- 中国乙腈市场预测与战略咨询研究报告(2022版)
- Oom caused by improper use of multithreading
- In depth Research Report on China's disposable sanitary products production equipment industry (2022 Edition)
- Irradiance, Joule energy, exercise habits
- From comedians to NBA Zhan Huang, check the encrypted advertisements during this super bowl
- Fresh, 2022 advanced Android interview must know 100 questions (interview questions + answer analysis)
- Redis -- data type and operation
猜你喜欢

Countdownlatch blocking wait for multithreading concurrency

Intelligent operation and maintenance practice: banking business process and single transaction tracking

【Try to Hack】vulnhub DC4

Gold, silver and four want to change jobs, so we should seize the time to make up

Data warehouse (3) star model and dimension modeling of data warehouse modeling

Penetration practice vulnhub range Tornado

Gameframework eating guide

Product service, operation characteristics

Fresh, 2022 advanced Android interview must know 100 questions (interview questions + answer analysis)

官宣!香港科技大学(广州)获批!
随机推荐
How to write good code - Defensive Programming Guide
New patent applications and transfers
China acetonitrile market forecast and strategic consulting research report (2022 Edition)
Research Report on development monitoring and investment prospects of China's smart environmental protection industry (2022 Edition)
JDBC: deep understanding of Preparedstatement and statement[easy to understand]
换掉UUID,NanoID更快更安全!
深度优先遍历和广度优先遍历[通俗易懂]
Intel's open source deep learning tool library openvino will increase cooperation with local software and hardware parties and continue to open
Official announcement! Hong Kong University of science and Technology (Guangzhou) approved!
(12) About time-consuming printing
The latest intelligent factory MES management system software solution
Smart factory digital management system software platform
Develop those things: easycvr cluster device management page function display optimization
China biodegradable plastics market forecast and investment strategy report (2022 Edition)
徽商期货是正规期货平台吗?在徽商期货开户安全吗?
Research Report on development prediction and investment direction of nylon filament sewing thread in China (2022 Edition)
Development cost of smart factory management system software platform
剑指 Offer 20. 表示数值的字符串
SLO is increasingly used to achieve observability | Devops
手机开户股票开户安全吗?那么开户需要带些什么?