How do I zipalign my apk?

Get help using Construct 2

Post » Tue Jun 23, 2015 8:56 pm

I've tried uploading the apk ludei gave to me on google store but they are asking me to run the zipalign tool,what is that?and how do I succesfuly publish my app?
B
6
S
1
Posts: 37
Reputation: 600

Post » Tue Jun 23, 2015 9:42 pm

You need to sign and align your APK before it can be uploaded to Google Play. Here's how I've been doing it, but it's been a while since the initial installation so you might have your own hurdles and discoveries. It was a slight PITA to get this set up, but once you get the through the initial part the process is quite fast each time you need a signed/aligned APK.

To sign it, you'll need the "jarsigner" tool. To install that tool, just get the latest Java JDK.

To align it, you'll need the "zipalign" tool. To install it, get the latest Android sdk and then find the zipalign.exe file somewhere in the installation (I forget where it is). Ultimately, make sure you have zipalign.exe sitting in Android\sdk\tools.

So now, you'll need to create a keystore which will be used to sign the APK. I don't remember how I made mine, but I've linked to some tutorial that will hopefully work for you.

Now, here's what I have done to make this process easy for myself (I don't know if this is the best way or anything, I feel like I'm clueless on the whole, I'm barely getting by). In the root of E:\, I place my keystore file. Each time I have a new unsigned APK, I also place it here and call it Unsigned.apk or something to that effect.

Now, I have a text document called "SignAndAlignScripts.txt", which contains the following text, including line breaks:
Code: Select all
jarsigner -verbose -keystore E:\mykey.keystore -storepass MY_PASSWORD -keypass MY_PASSWORD E:\Unsigned.apk MY_COMPANY

zipalign -v 4 E:\Unsigned.apk E:\SignedAndAligned.apk


The first part signs the APK, and the second aligns it. By pasting that text into command prompt, it'll automatically run both events and you'll wind up with a SignedAndAligned.apk that you can upload to Google. There's probably an easier way, like in a batch file or something so that you just have to double-click it, but the bottom line is that it's convenient to have a script to make it all one process. Now every time I need a new signed-aligned APK, I just place my unsigned file in E:\, name it appropriately, and then run this script. Voila, easy signed/aligned APK.

Disclaimer: I have only very little clue of what I'm doing, learning lots along the way, like you. There may be a far better way, so wait a little while in case there's a better response :P

EDIT: I think I found the tutorial I followed. It was on Scirra all along. Follow that and you should be good to go! https://www.scirra.com/tutorials/861/ho ... id-app-apk
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Wed Jun 24, 2015 5:06 am

Image Image iTunes: Match3 | Google Play: Match3
B
100
S
35
G
30
Posts: 1,136
Reputation: 28,085

Post » Wed Jun 24, 2015 6:40 am

I can recommend the tool that AndreasR mentions - works great!
Image
Get it on Google play or play on papio.nu
B
11
S
2
Posts: 79
Reputation: 786

Post » Wed Jun 24, 2015 8:55 am

Thanks both of you :D
B
6
S
1
Posts: 37
Reputation: 600

Post » Wed Jun 24, 2015 3:46 pm

Do you mean in the old cloud or in the new one? In Cocoon.io you should get an already signed and aligned apk ready for uploading it to the store without issues.
B
9
S
4
G
4
Posts: 383
Reputation: 3,616

Post » Thu Jun 25, 2015 11:44 am

didn't knew you guys have a new platform :P
don't have acces to it now,but thanks for the tip :D
B
6
S
1
Posts: 37
Reputation: 600


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 36 guests