In my last post about releasing for android, I had a long list of commands that you had to run, to finally create a releasable apk file. It looked something like this:
Well, that’s kinda complicated. And it turns out, there’s any easy way to do all of this with just this:
1 ant release
What?!? How can the first command do the same thing as 5 commands?
The answer is with a few configuration files that will let ant know where the keystore file is and what its passwords are.
First open build.xml and make sure that it has this line:
1 <property file="ant.properties" />
And this line:
Then open ant.properties and make sure it looks like this:
The key.store can either be an absolute path (like the example above), or a relative path like this:
Then open custom_rules.xml (create it, if it doesn’t exist) and make sure it looks like this:
This will point to a custom file that will store your passwords for your keystore file. In this example, I’m pointing 3 directories above the current directory. Since this file will contain sensitive information, it’s best to keep it outside of your source control. You can either put it outside of your source control as I did, you you can ignore the file in your .gitignore.
Create the secure.properties file, in the location of your choice and set it up like this. It contains the password for your key store and alias.
And there you have it. You should just be able to run
and you should get a final apk output in the bin directory. Just remember to go into your AndroidManifest and set debuggable to false.