1,需要在jenkins中安装 android sign plugin,安装后可以在可使用的TAB中找到。

在jenkins中,用android sign plugin 对apk进行签名


2.需要把签名用的jks文件转换成pkcs12,通过keytool,如果没有的话,可以先安装,转换命令如下

[email protected]:/home/XXXX# keytool -importkeystore -srckeystore sign-key.jks -srcstoretype JKS -deststoretype PKCS12 -destkeystore keystore.p12
Importing keystore sign-key.jks to keystore.p12...
Enter destination keystore password:
Re-enter new password:
Enter source keystore password:
Entry for alias devops-alias successfully imported.
Import command completed:  1 entries successfully imported, 0 entries failed or cancelled

3.需要把上边生成的keystore.p12文件上传到Jenkins的Credential里,生成认证书

在jenkins中,用android sign plugin 对apk进行签名

在jenkins中,用android sign plugin 对apk进行签名

 

4.在pipeline中,使用下面的方法进行签名

  signAndroidApks (
      keyStoreId: "xxxx-xxx-xxx-xxx-xxx",
      keyAlias: "${Name}",
      apksToSign: "app.apk",
      skipZipalign: true
  )

通过上面的命令生成一个app-signed.apk的签名后的文件,这个就是签名后的文件了

 

详细参见:

https://github.com/jenkinsci/android-signing-plugin


 

 

   

相关文章:

  • 2021-05-18
  • 2021-10-27
  • 2021-10-06
  • 2021-12-04
  • 2021-10-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-11-17
  • 2021-08-21
  • 2022-12-23
  • 2021-12-26
相关资源
相似解决方案