Let's say I have a whole lot of Android projects, how would I go about, export and digitally sign them all at once, is it even possible to do through eclipse?
Any thoughts of the matter will be greatly appreciated.
In Eclipse it's not possible to export multiple projects without human intervention.
You can script it by creating ANT build.xml files for all of your projects. The ANT build files allow you to specify the keystore path and key alias that you want to use to sign your APK.
You can create a simple script that goes through all of your projects, and calls the ant release target. This will generate a signed APK file.
That way, you can export all of your apps with a single script.
More information can be found on :
http://developer.android.com/guide/developing/building/building-cmdline.html
Related
I am having a android source and i am building that source and generate apk manually. Manually in the sense using ant release jarsigner and zipalign. I got the singed APK working. Now i am trying to add folders to the apk before signing it or It is possible to add it while the ant build process .Is this possible if so share me the commands.I saw aapt command is used to add files but not folders..
Thanks in Advance
Regards,
Deepak
How to build and package the android project with Ant.
I want to build and package a android project automatic with Ant,not the Eclipse.
Someone give me some examples or some Ant build files.
Assuming you are inside the root folder of your project, execute from a terminal/shell/console/command prompt:
android update project -p .
This will generate the necessary files, including build.xml. Modify it for your requirements, or leave it as it is for standard build behaviour.
To create a debug build, execute:
ant debug
Or swap out debug for release for a release build. Note that you will need to provide details to the release key in order to complete the signing process (keystore location, keystore password, key alias and key password). If you don't, you will end up with an unsigned apk that you'll have to manually sign using the appropriate key.
I prefer to do a clean with most builds as well, so the command I issue with every release build looks like:
ant clean release
References:
Managing Projects from the Command Line
Building and Running
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.
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
I have an android app which needs to be signed using a specific keystore for it to be able to communicate with another app. I see that I can put the keystore file in a specific location for eclipse to use it. I don't find any documentation on how to configure the keystore in build.xml for ant builds though.
Per my research so far, the only way is to achieve this is to copy the keystore file to the default android keystore path (which is generally located under ~/.android directory.
For Ant builds you just need to add lines like these to the build.properties file:
key.store=c:/users/me/my-release-key.keystore
key.alias=release_alias
key.store.password=MyStorePassword
key.alias.password=MyKeyPassword
assuming that your build.xml is based on the main_rules.xml that comes with the SDK
I'm using Maven for that and it works fine. I have configured multiple build profiles like "release", "devel" etc. signed with different keys. If you want to use Maven look for maven android plugin.
In eclipse it is done through window-preferences-android-build-custom debug keystore.
As you can see from there, default debug keystore is located in .android/debug.keystore at your homedir (~ at linuxes and c:\Users\whatevah on windowses).
So you can replace default ~/.android/debug.keystore with your custom.