jarsigner resigned apk could not install the solution

  • 2020-05-30 21:03:41
  • OfStack

For some reason, the jarsigner tool was needed to re-sign the unsigned apk, but after signing, apk could not be installed, which was a mystery. Finally found a solution, now to share with you:

When signing, add two parameters:


-digestalg SHA1 -sigalg MD5withRSA

The cause of the failure to sign is initially estimated to be a problem with the JDK version. JDK 1.6 signatures are fine, but 1.7 will cause this problem.

The complete signature command is as follows:


jarsigner -verbose -keystore feelyou.keystore -storepass feelyou.info -signedjar signed.apk -digestalg SHA1 -sigalg MD5withRSA unsigned.apk feelyou

Explanation:

1, -keystore feelyou. keystore: specify the signature file to be used. Write the file name directly in the current directory, otherwise specify the specific path
2, -storepass feelyou. info: I used feelyou. info for keystore and alias
3. -signedjar signed.apk: specifies the file storage path after the signature, which means that the file name signed.apk exists in the current path
4, -digestalg SHA1-sigalg MD5withRSA: this is the parameter that must be added. If you are jdk 1.6, it will not be affected
5, unsigned.apk: the unsigned apk path. Here is the unsigned.apk file in the current path
6. feelyou: this last one is alias


Related articles: