How to zipalign the .apk file using eclipse? - android

Can anyone tell me how to zipalign my .apk file with using eclipse. I have made my .apk file by giving command like,
Right Click on Project Folder
Click on "Android Tools" option from menu.
Click on "Export Signed Application Package..." and my .apk generated in given application alias.
Now want to do zipalign for this above generated .apk file. Does any tool require to do so OR anything that can solve my problem.

If you did what you described above then Eclipse has already zipaligned your apk for you. You can't zipalign an already zipaligned package

I think this will help you
D:\android-sdk\android-sdk\tools>zipalign -f -v 4 "C:\Users\name\Desktop\project_name\projectname_signed.apk" "C:\Users\name\Desktop\project_name\projectname__zipaligned.apk"

Using the steps given, Eclipse will do zipalign for you.

This is a very tricky part and initially i was also ran in to strange problems . Before uploading to android market you must do the following steps.
Create a Certificate
Signing your application apk
Finally Zip align the signed apk
Check this site: How to sign Android project apk

Eclipse zipalign APKs when you export them by default.
zipalign is basically a tool available in tools directory of your android sdk.
In case you are not using eclipse to build, you can use this tool directly to zipalign your apk.
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
The alignment is an integer that defines the byte-alignment boundaries. This must always be 4 (which provides 32-bit alignment) or else it effectively does nothing.
For more detail, check this link
http://developer.android.com/tools/help/zipalign.html

If you to signed and zip aligned your APK file, so that you could redistribute your file and upload it play store. Then follow these simple steps
Open Eclipse
File--> Export
Browse-->Select your project
Next-->Next
So, after all of that you will get an APK which will be signed and zip aligned.

Eclipse zipalign apk automatically. When you export the project, eclipse must be generating signed apk to a different destination. Check properly where it prompts when you generate a signed apk

Eclipse automatically zipaligns your .apk file if you did what you described above.

Related

Replacing .so file in signed apk

I have generated signed apk from Android Studio, it contains ndk and compiled as .so in lib folder inside the apk.
Because of a problem I am facing here:
Checksum value of classes.dex keep changing with Dexguard for every build
I want to replace the .so without re-building the classes.dex in the signed apk. However, after unzipping the apk and re-pack it. It cannot be installed, although I have signed the re-packed apk again using "jarsigner -verbose -keystore".
Any hints for how can I do that? Thanks.
Did you run zipalign after signing?
zipalign -v 4 your_project_name-signed.apk your_project_name-aligned.apk
See the final step in http://developer.android.com/tools/publishing/app-signing.html#signing-manually

Is there a difference between a signed apk and the one residing in my bin folder?

I need to export an APK to CD for my university coursework.
First of all I've done my whole project folder, and after coming into some problem trying to export a signed apk, I noticed it was in my project bin folder anyway.
Is there anything wrong with this apk? Is it runnable on other devices?
no difference, the apk should install and run on other devices.
Your apk may be signed with default keystore for debug build, or your own keystore depending on how you configured.
Just for testing, you can use apk in bin folder. But to submit to playstore and all you need a signed apk. Try with another keystore or remove build automatically option while generating apk.
Yes you can run APK of bin folder in any of the device for testing purpose . But if you want to Upload your APP to Palystore then you have to Export it(signed with release keystore) in this case APK of bin folder will not work .
Hope this info will be helpfil for you.

You uploaded an APK that is not zip aligned error

I have just finished and signed the apk through android studio,
then I have did an apk protect through apkprotect.com
when I am trying to upload the apk to play store I got this error " You uploaded an APK that is not zip aligned. You will need to run a zip align tool on your APK and upload it again. "
if I upload the original apk I got no errors,
I have tried to add zipalign true in the build.gradle but nothing happened
I have tried also disable and enable proguard .
You can run zipalign manually in command line:
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
Note that zipalign is located inside ${sdk.dir}\tools
For more details visit zipalign
[Update]
Also, If you need to sign it you can run:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore YOURKEYSTORE unsigned.apk alias_name
(jarsigner is located inside java JDK_HOME/bin)
I got the same "You uploaded an APK that is not zip aligned... blah, blah" error when by mistake I tried to upload a DEBUG version of my .apk file to Google Play. It's a bit misleading error because the real problem is that you cannot distribute a debug version which additionally is not signed with your Google Android Developer key. (You can only upload an .apk compiled as release version, and it must be signed, which happens in the same step, at least if you're using Eclipse).
Make sure you distribute an .apk file which is your Signed Release version, as described here:
http://developer.android.com/tools/publishing/app-signing.html#releasecompile
This question and its answers are old; so we expect things to change. As of today, the zipalign tool is in the ANDROID_HOME directory under build-tools/[version]/ so my path is currently:
/android-sdk/build-tools/22.0.0/zipalign
Using the zipalign tool is not necessarily the answer here though, what you actually need to do is sign your apk.
Steps if using Xamarin for VS2017:
Build project
Right click and Archive project
Use Ad Hoc distribution channel
Sign your APK with your Signing Identity and Save As to produce an APK that is ZIP aligned.
Your APK can be uploaded to Google Play.
I was using Cordova, uploaded a signed APK but still got this error.
The ziptool is what helped me, it's located at ~AndroidSDK\build-tools\24.0.0\zipalign.exe
So for example :
"~\AndroidSDK\build-tools\24.0.0\zipalign.exe" -f -v 4 android-release-signed.apk android-release-signed-zipaligned.apk
I was using Cordova and the command line getting this error. I opened the project in Android Studio and used Android Studio to build the signed apk and the error went away.
When using the Cordova node.js CLI without going through Android Studio, it is necessary to update the PATH environmental variable to include the android build tools:
%ANDROID_HOME%\build-tools\29.0.2
Obviously the version number will change over time. Remember to close any CLI windows and re-open them to recognize the newly added path.

how to sign android rom.zip file?

For some reason I need to change android rom zip file. But when I change add/remove content, my rom cant be installed. Its need to be resigned.
I want to know if there is any simple command in Mac OS by which I can sign the rom.zip file
I guess you don't have eclipse installed (it can sign your applications automatically)
First, download the signing tools and extract them anywhere
http://goo.gl/lRNlE8
Copy your zip or apk files to signing tools folder
And run the following command:
java -Xmx1024m -jar signapk.jar -w testkey.x509.pem testkey.pk8 my_rom.zip my_signed_rom.zip
Replace my_rom.zip with the name of the file you want to sign and my_signed_rom.zip with the new name you want to give to your zip or apk.
Please note the signing tools contain test keys, make sure to replace them with your own.
If you want to know more about app signing, I suggest you go directly to the source:
http://developer.android.com/tools/publishing/app-signing.html

Android Signing application on Windows

I am trying to Sign up APK to upload it on to the Play Store Market. I am following the steps underlined here
I am getting the following error
When i try to Sign the Application using Eclipse project->Android Tools->Export Signed Application Package.
You don't need to do it with commands. In Eclipse, right click on your project->Android Tools->Export Signed Application Package.
Follow the wizard and you will have an signed apk without pain.
Edit:
After a quick search about the new error, this thread seems to contain possible fix for you. At instance, please try to clean your project and build it again. If it does not fix your problem, also try the fix mentioned in the link.
Copy your keystore file to a directory which has no spaces. Your current path is C:\Program Files (x86)\Java\jdk1.6.0_27\bin\my-release-key.keystore which contains the directory Program Files (x86) with spaces. JarSigner cannot identify directories with spaces.

Categories

Resources