charlest
charlest

Reputation: 935

android ant build: debug and release targets

According to the 'help' target documentation:

  1. debug: builds the applications and signs it with a debug key
  2. release; builds the application: the generated APK file must be signed before it is published

Here is what I found, which is a bit different than what I expected:

debug: ignores keystore definitions in build.properties whether you specify them or not. Which kesystore file is it using? The same as Eclipse: the default debug.keystore file in your Documents and Settings?

It creates two files:

  1. -debug-unaligned.apk (signed, unaligned)
  2. -debug.apk (signed, aligned)

release: 'help' says it doesn't sign it. It creates these files:

  1. -unsigned.apk (unsigned, unaligned)

The next two are only if you have the values specified in build.properties:

  1. -unaligned.apk (signed, unaligned)
  2. -release.apk (signed, aligned)

Any helpful comments / verifications will be greatly appreciated.

Upvotes: 8

Views: 13244

Answers (3)

wufawei
wufawei

Reputation: 51

This answer works for me, I am using ant to auto-compile android app, it prompts and need password, I wrote one file named password, and using the command ---ant release < passwd, However, it also prompts that I need input password.

Using the tips here

key.store=c:/users/me/my-release-key.keystore
key.alias=release_alias
key.store.password=myStorePassword
key.alias.password=myAliasPassword

I solved this problem.

Upvotes: 1

NickT
NickT

Reputation: 23873

As far as the release target goes, you will get behaviour like this:

If you have lines like:

key.store=c:/users/me/my-release-key.keystore
key.alias=release_alias
key.store.password=myStorePassword
key.alias.password=myAliasPassword

in your build.properties, it will automatically build and sign your apk with no prompting for anything.

If you comment out the last two lines, then it will prompt you for the passwords, then complete a signed build if the passwords are OK.

If you don't have any of the above lines, then it will just build you an unsigned apk with no prompting for anything and end with:

-release-nosign:
[echo] No key.store and key.alias properties found in build.properties.
[echo] Please sign C:\dev\projects\AntBuilds\MyProject\bin\MyProject-unsigned.apk manually
[echo] and run zipalign from the Android SDK tools.

.

Upvotes: 7

CommonsWare
CommonsWare

Reputation: 1006614

Which kesystore file is it using? The same as Eclipse: the default debug.keystore file in your Documents and Settings?

Yes.

Upvotes: 10

Related Questions