Is it possible to specify the location of a self created debug keystore when creating debug .apk
's (<project-name>-debug.apk
) with ant debug
? I only see the possibility to specify the location of the release keystore.
I would like to share the debug keystore over multiple PC's without copying them over the the one that is placed in the '.android' directory. The debug keystore could for example reside within the source code repository. But I need a way to tell ant where to find the debug keystore.
I found the another solution..
Add the following in ${PROJECT_HOME}/custom_rules.xml
You should be able to specify the keystore to use with these properties
Just pass the properties in to Ant.
[EDIT] From the docs at http://developer.android.com/guide/publishing/app-signing.html#setup
The Android build tools provide a debug signing mode that makes it easier for you to develop and debug your application, while still meeting the Android system requirement for signing your .apk. When using debug mode to build your app, the SDK tools invoke Keytool to automatically create a debug keystore and key. This debug key is then used to automatically sign the .apk, so you do not need to sign the package with your own key.
The SDK tools create the debug keystore/key with predetermined names/passwords:
If necessary, you can change the location/name of the debug keystore/key or supply a custom debug keystore/key to use. However, any custom debug keystore/key must use the same keystore/key names and passwords as the default debug key (as described above). (To do so in Eclipse/ADT, go to Windows > Preferences > Android > Build.)
As far as I can tell, in order to do this you need to override the "-do-debug" target. I'd like to know if there's a more elegant way, though. I added this to my build.xml
One easy method you can use as a work-around (which is especially nice in our CI system where many projects are built and where a soft touch is required when dealing with keystores), is to go ahead and run the debug build, use AAPT to remove the contents of the META-INF folder, and run jarsigner to sign it with your custom debug.keystore.
In pseudo-script, it looks like: # Normal Ant debug build ant debug
You can remove the signature of the final apk and sign it again. It is just a debug build so the zipalign can be avoided (at least I have no problems in my build).
Copy your keystore to a file debug.keystore in the project and add the following in ant.properties
And add the following in your build.xml
Create a new and empty folder within your Eclipse workspace.
Copy the file "debug.keystore" from its standard location (e.g. "c:/Users/YourAcount/.Android/" on Windows) into that new directory.
Configure Eclipse to use that new directory/file for all Debug APKs (Eclipse --> Window --> Preferences --> Android --> Build --> Custom Debug Keystore".