[GUIDE]GUI - SignApk Jar File Tutorial to Sign and Align APKs

Search This thread

munnibhai

Senior Member
Nov 14, 2012
188
72
Gujranwala
Hello guys,
I am here with an easy to use application about creating your own keystore to sign APKs and align them.

Requirements:
  • JDK - Download from www.java.com
  • sign.jar - Download HERE - APK-Signer 1.8.3 by Hai Bison - working link as of 05/03/2016

Please note that you need to have JDK installed in system for jar files to work.

INITIAL SETUPS
  1. Assuming that you have JDK installed, download sign.jar and extract in anywhere you can navigate easy.
  2. I have it in "C:/apktool"
  3. Open Command Prompt (click Start > type cmd in search box and press enter)
  4. Navigate to folder where you extracted jar file, in my case "c:\>cd apktool".
  5. Type, "java -jar sign.jar"
  6. The writing things ends here and you will see application opened in GUI - as follows

i6xi.jpg

CREATE KEYSTORE
  1. Now, we will need to first create a keystore file,
  2. Click on "Save As" in Target Tab and name the file anything, i named it "signedOne"
  3. Click on Save Button
  4. Now We will need to fill the form a little,
  5. In Password, type any password you may remember
  6. in Alias, type any name, usually that should be similar to your UNSIGNED apk file name
  7. Give an Alias Password (for ease, keep it same as password above)
  8. In Name field, Type your first and last name,
  9. This is the minimum required in form, if you want to fill full form, thats upto you.
  10. Click on Button "Generate Keyfile"
  11. Wait until message appears, "Keyfile Generated Successfully". Press OK

SIGN APK
Now its time to sign the APK. - Click on "Signer" Tab.

u5ak.jpg


  1. First, Click on button "Load Keyfile"
  2. Browse for the same keystore file you created, in our case, if you kept the name same as mine, that will be "signedOne.keystore"
  3. Type the password you gave while creating the keystore file.
  4. You will see alias name appearing automatically below if password was correct.
  5. type the alias password you gave earlier.
  6. Click on "Load Target File" and browse for the APK file you want to sign. In my case "whatsapp.apk"
  7. Click on "Sign" button
  8. Wait until the dialog appears, "File Signed"
  9. You will see a new file whatsapp_SIGNED_UNALIGNED.apk in the same folder where whatsapp.apk was already present

ALIGN APK
Click on APK Alignment Tab

  1. Click on "Load APK file" button
  2. Browse for "whatsapp_SIGNED_UNALIGNED.apk
  3. Click on "Align" button
  4. Wait until the message appears "Alignment done, output file: "whatsapp_SIGNED_ALIGNED.apk"
  5. Optional - If you want to verify the alignment, click on "whatsapp_SIGNED_UNALIGNED" button - note that after the alignment, the button name remained same
  6. browse for "whatsapp_SIGNED_ALIGNED.apk
  7. Click on button verify
  8. it will give you a message, "Verification succesful"

TROUBLESHOOTING

If you get java,util exception error, you need to use JDK-6 or lower and give its path in JDK target adress bar
JDK-7 and plus have changed something for which APK signer doesnt sign APKs


Plz click Thanks buttong if it helped u
 
Last edited:

munnibhai

Senior Member
Nov 14, 2012
188
72
Gujranwala
Hey you wouldn't happen to know what im doing wrong in resigning the latest flash player ics.apk from http://helpx.adobe.com/flash-player/kb/archived-flash-player-versions.html im trying to change the user agent and version with a hex editor. So I thought that editing the lib file was goofing it up so I just tried to simple extract the apk and resign it and it still wont work.

Any ideas what wrong?

Its better to compile the apk back using apktool.

If you are first time using this tutorial above, maybe youare are not creating the keystore file. Can you post the apk here for me to look at it?

Sent from my GT-I9100 using xda app-developers app
 

bwarrington85

Member
Nov 14, 2013
22
1
Error while signing file. Details:

jar signed.

Warning:
No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date(2040-04-01) or after and future revocation date.

End of line

No signed apk is created. Any ideas?
 

munnibhai

Senior Member
Nov 14, 2012
188
72
Gujranwala
Error while signing file. Details:

jar signed.

Warning:
No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date(2040-04-01) or after and future revocation date.

End of line

No signed apk is created. Any ideas?

Its because you need to create a key first, before signing the apk

Sent from my TURBO DG2014 using XDA Free mobile app
 

bwar85

Member
Aug 18, 2014
27
0
Were you able to resolve the issue? Or else please attach your apk and i have a look on it

Sent from my TURBO DG2014 using XDA Free mobile app

No, I am trying to mod a cm12 theme from the playstore. I am simply trying to replace images in the apk. I am NOT trying to release the modded apk, it is for my enjoyment only. Isnt that what your jar does?
 

munnibhai

Senior Member
Nov 14, 2012
188
72
Gujranwala
No, I am trying to mod a cm12 theme from the playstore. I am simply trying to replace images in the apk. I am NOT trying to release the modded apk, it is for my enjoyment only. Isnt that what your jar does?

jar file is working perfectly, there is some problem with your theme, keystore file most probably. how did you extraxt the apk? with 7zip or apktool?
 

munnibhai

Senior Member
Nov 14, 2012
188
72
Gujranwala
No, I am trying to mod a cm12 theme from the playstore. I am simply trying to replace images in the apk. I am NOT trying to release the modded apk, it is for my enjoyment only. Isnt that what your jar does?

I used apktool. I give up on trying to edit apks. There are no tutorials that work.

I am sorry to hear about that, well, apk editing isnt diffictult, apart from decoding java files and then actually coding them again (lets leave it to java programmers)

About editing graphics and XMLs in apk, its easy, ask me anything you want.
 
  • Like
Reactions: bwar85

munnibhai

Senior Member
Nov 14, 2012
188
72
Gujranwala
No, I am trying to mod a cm12 theme from the playstore. I am simply trying to replace images in the apk. I am NOT trying to release the modded apk, it is for my enjoyment only. Isnt that what your jar does?

ok, I got to the root of error.
The problem is JDK8 and 7 too probably. The jarsigner provided with these 2 versions, is timestamped now and while we try to sign an apk using the sign.jar, jarsogner isnt finding any timestamp on it.

So you will either need to downgrade to JDK6 (just install as additional and give path to it in sign.jar) and it will work
 
  • Like
Reactions: bwar85

bwar85

Member
Aug 18, 2014
27
0
ok, I got to the root of error.
The problem is JDK8 and 7 too probably. The jarsigner provided with these 2 versions, is timestamped now and while we try to sign an apk using the sign.jar, jarsogner isnt finding any timestamp on it.

So you will either need to downgrade to JDK6 (just install as additional and give path to it in sign.jar) and it will work

I was using either 8 or 7.

I will try 6 and post results
 

bwar85

Member
Aug 18, 2014
27
0
I was using either 8 or 7.

I will try 6 and post results

Well your sign.jar completed all tasks with no errors and the app installs but is then rejected by the cm12 theme engine and automatically uninstalls.

So I took the original cm12 theme apk, removed the Meta-inf folder, used sign.jar, and it works.

My error must be in editing the .pngs images within the theme I'm guessing. Im using photoshop 7 to invert colors on the .pngs and saving. Why does changing the .pngs affect the apk from installing I wonder?

So I'll give thanks, your sign.jar does infact work with JDK 6

*edit: Cant give thanks? Hmm no thanks button...
 
Last edited:

munnibhai

Senior Member
Nov 14, 2012
188
72
Gujranwala
Well your sign.jar completed all tasks with no errors and the app installs but is then rejected by the cm12 theme engine and automatically uninstalls.

So I took the original cm12 theme apk, removed the Meta-inf folder, used sign.jar, and it works.

My error must be in editing the .pngs images within the theme I'm guessing. Im using photoshop 7 to invert colors on the .pngs and saving. Why does changing the .pngs affect the apk from installing I wonder?

So I'll give thanks, your sign.jar does infact work with JDK 6

*edit: Cant give thanks? Hmm no thanks button...

I am glad that it worked afterall.

1. About the PNGs, there are some with .9 extension in them, if you noticed, they have those black lines around them which must not be touched, they have to be with #000 color. This could be one of problems while you just changed colors.

2. Another issue maybe RGB profile (I am not sure if this setting is available in Ph.7) of photoshop, so goto Edit : Color Settings : RGB : <select "Monitor RGB">. Save and Restart.

Let me know if it worked.
 
  • Like
Reactions: bwar85

bwar85

Member
Aug 18, 2014
27
0
I am glad that it worked afterall.

1. About the PNGs, there are some with .9 extension in them, if you noticed, they have those black lines around them which must not be touched, they have to be with #000 color. This could be one of problems while you just changed colors.

2. Another issue maybe RGB profile (I am not sure if this setting is available in Ph.7) of photoshop, so goto Edit : Color Settings : RGB : <select "Monitor RGB">. Save and Restart.

Let me know if it worked.

It was the .9.pngs. Messed up the black lines... Fixed and it all works! Thanks for the cool jar!
 
R

raki2485

Guest
Please help "FileNotFoundException: .x509.pem"

Thank you, your method works well good for all app.

But for this application "Advanced Permission Manager" by steelworks on google playstore.

Signed process working well, app initially runs good but app main function not working after repacking apk and signed.

It will throw exception "FileNotFoundException: .x509.pem"

What is that exception? I tried every method, I searched whole internet no single solution.:(
 

Top Liked Posts

  • There are no posts matching your filters.
  • 8
    Hello guys,
    I am here with an easy to use application about creating your own keystore to sign APKs and align them.

    Requirements:
    • JDK - Download from www.java.com
    • sign.jar - Download HERE - APK-Signer 1.8.3 by Hai Bison - working link as of 05/03/2016

    Please note that you need to have JDK installed in system for jar files to work.

    INITIAL SETUPS
    1. Assuming that you have JDK installed, download sign.jar and extract in anywhere you can navigate easy.
    2. I have it in "C:/apktool"
    3. Open Command Prompt (click Start > type cmd in search box and press enter)
    4. Navigate to folder where you extracted jar file, in my case "c:\>cd apktool".
    5. Type, "java -jar sign.jar"
    6. The writing things ends here and you will see application opened in GUI - as follows

    i6xi.jpg

    CREATE KEYSTORE
    1. Now, we will need to first create a keystore file,
    2. Click on "Save As" in Target Tab and name the file anything, i named it "signedOne"
    3. Click on Save Button
    4. Now We will need to fill the form a little,
    5. In Password, type any password you may remember
    6. in Alias, type any name, usually that should be similar to your UNSIGNED apk file name
    7. Give an Alias Password (for ease, keep it same as password above)
    8. In Name field, Type your first and last name,
    9. This is the minimum required in form, if you want to fill full form, thats upto you.
    10. Click on Button "Generate Keyfile"
    11. Wait until message appears, "Keyfile Generated Successfully". Press OK

    SIGN APK
    Now its time to sign the APK. - Click on "Signer" Tab.

    u5ak.jpg


    1. First, Click on button "Load Keyfile"
    2. Browse for the same keystore file you created, in our case, if you kept the name same as mine, that will be "signedOne.keystore"
    3. Type the password you gave while creating the keystore file.
    4. You will see alias name appearing automatically below if password was correct.
    5. type the alias password you gave earlier.
    6. Click on "Load Target File" and browse for the APK file you want to sign. In my case "whatsapp.apk"
    7. Click on "Sign" button
    8. Wait until the dialog appears, "File Signed"
    9. You will see a new file whatsapp_SIGNED_UNALIGNED.apk in the same folder where whatsapp.apk was already present

    ALIGN APK
    Click on APK Alignment Tab

    1. Click on "Load APK file" button
    2. Browse for "whatsapp_SIGNED_UNALIGNED.apk
    3. Click on "Align" button
    4. Wait until the message appears "Alignment done, output file: "whatsapp_SIGNED_ALIGNED.apk"
    5. Optional - If you want to verify the alignment, click on "whatsapp_SIGNED_UNALIGNED" button - note that after the alignment, the button name remained same
    6. browse for "whatsapp_SIGNED_ALIGNED.apk
    7. Click on button verify
    8. it will give you a message, "Verification succesful"

    TROUBLESHOOTING

    If you get java,util exception error, you need to use JDK-6 or lower and give its path in JDK target adress bar
    JDK-7 and plus have changed something for which APK signer doesnt sign APKs


    Plz click Thanks buttong if it helped u
    1
    Download Zipsigner from playstore . It will help you to sign your app through your mob. device .

    Sent from my GT-S7562 using XDA Premium 4 mobile app
    1
    No, I am trying to mod a cm12 theme from the playstore. I am simply trying to replace images in the apk. I am NOT trying to release the modded apk, it is for my enjoyment only. Isnt that what your jar does?

    I used apktool. I give up on trying to edit apks. There are no tutorials that work.

    I am sorry to hear about that, well, apk editing isnt diffictult, apart from decoding java files and then actually coding them again (lets leave it to java programmers)

    About editing graphics and XMLs in apk, its easy, ask me anything you want.
    1
    No, I am trying to mod a cm12 theme from the playstore. I am simply trying to replace images in the apk. I am NOT trying to release the modded apk, it is for my enjoyment only. Isnt that what your jar does?

    ok, I got to the root of error.
    The problem is JDK8 and 7 too probably. The jarsigner provided with these 2 versions, is timestamped now and while we try to sign an apk using the sign.jar, jarsogner isnt finding any timestamp on it.

    So you will either need to downgrade to JDK6 (just install as additional and give path to it in sign.jar) and it will work
    1
    Well your sign.jar completed all tasks with no errors and the app installs but is then rejected by the cm12 theme engine and automatically uninstalls.

    So I took the original cm12 theme apk, removed the Meta-inf folder, used sign.jar, and it works.

    My error must be in editing the .pngs images within the theme I'm guessing. Im using photoshop 7 to invert colors on the .pngs and saving. Why does changing the .pngs affect the apk from installing I wonder?

    So I'll give thanks, your sign.jar does infact work with JDK 6

    *edit: Cant give thanks? Hmm no thanks button...

    I am glad that it worked afterall.

    1. About the PNGs, there are some with .9 extension in them, if you noticed, they have those black lines around them which must not be touched, they have to be with #000 color. This could be one of problems while you just changed colors.

    2. Another issue maybe RGB profile (I am not sure if this setting is available in Ph.7) of photoshop, so goto Edit : Color Settings : RGB : <select "Monitor RGB">. Save and Restart.

    Let me know if it worked.