how to sign android rom.zip file? - android

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

Related

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.

Testing on Real device

If i use the .apk file that is in the bin directory in the project in the workspace instead of generating the .apk by exporting the project does it make difference?
The apk file in the bin is signed using the debug key, which loses the benefit of signing your App. Your App should be signed using your own key (which is specified when you export the project) which kind of uniquely identify your Apps and protects (or tries to protect) your Apps from having someone alter your App and republish it. Also, when you upload an update for your App, it must be signed with the same key as the original App, so make sure to keep this key safe.
You can use the apk from the bin folder while debugging, but when publishing the app, you must export a signed apk, or sign the one from the bin folder manually.
However, an easier method would be to directly debug on a hardware device from eclipse, as this gives you access to various tools like the adb and LogCat, See this link for details.

Android sign apk file

I use this tutorial for sign my apk link
but I have stopped on the step Sign your application.
There is
./sign-mac-example.sh ../DialANumber/deploy/DialANumber.apk
Enter passphrase:
command
this not an internal or external program as I see in command line.
I use windows.
I have create all folder in workspce there are:
androidkeys (where I store my key my-release-key.keystore)
deploy (where I have export my apk file)
Thanks for help!
I can see this section a bit higher in the tutorial than the place you cite:
Write a short script to make your life easier Just to make the life
easier I wrote a short script which can be used each time to sign your
Android APK file. You can download it below and place it in the same
directory you placed the keystore at (see point 2).
Here the guy defines the script he calls with ./sign-mac-example.sh. However, regretfully this script is meat to work on linux and mac, not windows.
Nevermind the only line that is really crucial in this script is this:
jarsigner -verbose -keystore my-release-key.keystore "$1" alias_name
And you can use it in Windows also, just replace "$1" with ../DialANumber/deploy/DialANumber.apk.
I actually can not justify why the guy resorted to additional script here.
I recommend using Eclipse for signing Android Apps.
Therefore you have to install Android SDK and plugin for Eclipse. Create a project - When you're done, rghtclick on your Project and click export.
The wizard allows you to create a new keystore or use an existing one to sign your app.
I tried signing apps with console using Ubuntu, but it was hard - With Eclipse it's very easy and the export wizard creates the .apk

How to zipalign the .apk file using eclipse?

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.

Getting APK file from my project

I just press right on my appproject and choose Android Tools --> Export Unsigned Application Package...
But if i want to install the apk on my phone the install process dont finish
What do i have made wrong?
In eclipse you you go to run->build or if you have build automatically turned on you can go into the projects file structure and just copy the .apk file out of the bin folder. You can put this on the devices SD card and install it from there. No need to do the export unsigned apk thing.
The .apk must be signed.
Eclipse auto-generates an .apk signed with a debugging key at bin/YourApp.apk. It's ok to use this file for testing purposes, but you shouldn't give this .apk to customers or end-users because you won't be able to update this app in the future.
If you intend to publish this .apk to your customers you should use your own key to sign the .apk. Read: Signing Your Applications
Make sure you enabled 'Unknown sources' within the applications section of your phone settings.
If you already running your project on emulator,you just close that emulator.And goes to
Project->clean
Project->BuildProject.
And then run your project in emulator and then check it out
bin/res/your.apk file
You should use "Export Signed" instead of "Export Unassigned".
Google does not allow Android System to install "Export Unassigned" apk, see here -> http://developer.android.com/tools/publishing/app-signing.html.
To "Export signed", read here -> http://www.srccodes.com/p/article/23/build-android-application-package-file-apk-using-eclipse-ide-and-android-development-tools-adt-plugin

Categories

Resources