当前位置:网站首页>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
边栏推荐
- SPIE Western optoelectronics exhibition returned offline and successfully held a science and engineering event
- China PBAT resin Market Forecast and Strategic Research Report (2022 Edition)
- Sword finger offer II 105 Maximum area of the island
- Report on research and investment prospects of UHMWPE industry in China (2022 Edition)
- Heavy disclosure! Hundreds of important information systems have been invaded, and the host has become a key attack target
- February 16, 2022 Daily: graph neural network self training method under distribution and migration
- Openlayers customize bubble boxes and navigate to bubble boxes
- Research Report on development prediction and investment direction of nylon filament sewing thread in China (2022 Edition)
- Glidefast consulting was selected as the elite partner of servicenow in 2022
- Oom caused by improper use of multithreading
猜你喜欢

多线程使用不当导致的 OOM

Kia recalls some K3 new energy with potential safety hazards

Work and leisure suggestions of old programmers
![Integer array merge [JS]](/img/0d/70535e0eb1c299bda25159b58c70d7.png)
Integer array merge [JS]

走进微信小程序

(28) Shape matching based on contour features

Detailed explanation of string's trim() and substring()

Length of learning and changing

String的trim()和substring()详解

Euler function: find the number of numbers less than or equal to N and coprime with n
随机推荐
Function, condition, regular expression
Work and leisure suggestions of old programmers
Nielseniq found that 60% of the re launched products had poor returns
Vulnhub range hacksudo Thor
Common design parameters of solid rocket motor
Setting up a time server requires the client to automatically synchronize the time of the server at 9 a.m. every day
Official announcement! Hong Kong University of science and Technology (Guangzhou) approved!
Radhat builds intranet Yum source server
Alibaba cloud Li Feifei: China's cloud database has taken the lead in many mainstream technological innovations abroad
Source code of new campus errand / campus task platform on mutual station
[beauty detection artifact] come on, please show your unique skill (is this beauty worthy of the audience?)
SLO is increasingly used to achieve observability | Devops
Is it safe to open an ETF account online? What are the steps?
Euler function: find the number of numbers less than or equal to N and coprime with n
中国酶制剂市场预测与投资战略研究报告(2022版)
In depth Research Report on China's disposable sanitary products production equipment industry (2022 Edition)
Develop those things: easycvr cluster device management page function display optimization
Software construction scheme of smart factory collaborative management and control application system
SPIE Western optoelectronics exhibition returned offline and successfully held a science and engineering event
vulnhub靶场-hacksudo - Thor