50

I am using ant-release to do a 1-step build of my Android app.

My build.properties looks like this:

application.package=xxxxx
key.store=sonr
key.alias=sonr labs
key.store.password=xxxx
key.alias.password=xxxx

When I run ant-release everything is fine except for application signing. I get the error:

-release-prompt-for-password:

-release-nosign:
     [echo] No key.store and key.alias properties found in build.properties.
     [echo] Please sign /Users/syalam/Documents/git/joeborn-sonr/sonr/bin/SONR-release-unsigned.apk manually
     [echo] and run zipalign from the Android SDK tools.
[propertyfile] Updating property file: /Users/syalam/Documents/git/joeborn-sonr/sonr/bin/build.prop
[propertyfile] Updating property file: /Users/syalam/Documents/git/joeborn-sonr/sonr/bin/build.prop
[propertyfile] Updating property file: /Users/syalam/Documents/git/joeborn-sonr/sonr/bin/build.prop
[propertyfile] Updating property file: /Users/syalam/Documents/git/joeborn-sonr/sonr/bin/build.prop

How can I resolve this?

PS. I followed this tutorial for getting my build process down http://www.androidengineer.com/2010/06/using-ant-to-automate-building-android.html

Beau Grantham
  • 3,435
  • 5
  • 33
  • 43
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556
  • You're on a Mac it looks like. Have you used `ant-release` and that keystore successfully before? Have you moved any files around...could be a permission issue? – TryTryAgain Dec 24 '11 at 16:59
  • Yes, I'm on a Mac. This is my first time trying ant-release. I can export fine using the Eclipse GUI. – Sheehan Alam Dec 24 '11 at 17:07

6 Answers6

86

I had this problem too recently, I think that that tutorial is out of date...

The key.alias etc directives need to be in a file named ant.properties. There's no file called build.properties any more.

Reuben Scratton
  • 38,595
  • 9
  • 77
  • 86
  • This is definitely a step in the right direction! I'm getting the error `[signjar] jarsigner error: java.lang.RuntimeException: keystore load: /Users/syalam/Documents/git/joeborn-sonr/sonr/sonr (No such file or directory)` not sure why the extra `/sonr` directory is showing up, because it doesn't exist on my filepath, where can I change this? – Sheehan Alam Dec 24 '11 at 17:58
  • I don't know what 'sonr' is... are you sure this is a result of 'ant release' and not some unrelated process? What version of Ant & JDK are you using? – Reuben Scratton Dec 24 '11 at 18:06
  • ant release is the only command I'm running. Is there a place where I can specify the path for jarsigner to not include this extra /sonr directory? sonr is the name of my application – Sheehan Alam Dec 24 '11 at 18:34
  • 1
    I believe I have resolved it. They keystore needs to be in the same directory as build.xml, I had it in another folder – Sheehan Alam Dec 24 '11 at 18:39
  • 7
    ant.properties worked for me with the keystore set to a full path in another directory. – Paul Beusterien Dec 26 '11 at 00:23
  • Yes, you're absolutely right. Bizarre that the very latest download of Eclipse & Android SDK clearly says 'No key.store and key.alias properties found in build.properties' when you run ant release.. – Ben Clayton Apr 03 '12 at 15:37
4

Ultimate answer of any this kind of question is in android-sdk/tools/ant/build.xml

Document is at http://developer.android.com/guide/developing/building/building-cmdline.html

pinxue
  • 1,736
  • 12
  • 17
  • 1
    the link does not work anymore. please revise it and provide a new link. This is precisely why we had to paste the most important parts of the links we share on stackoverflow. – Asqan Aug 17 '16 at 09:11
3

regarding 'Sheehan Alam' issue that follows file name fix

[signjar] jarsigner error: java.lang.RuntimeException: keystore load: ...

You probably have key.store set to a value with a full path.

Make sure that you are using '/' and not '\'.

asaf gitai
  • 400
  • 2
  • 10
0

If you already have a project that you'd like to add the Ant build script to, then there is an easy command line tool you can use. Open up a command prompt and navigate to the base directory of your project. From there, use the command:

android update project --path .
wyf
  • 75
  • 8
0

add "<"property file="build.properties" /">" in your build.xml at the project folder.

larry
  • 1
0

Is keystore the name of your keystore file? From the tutorial:

Where keystore is the name of your keystore file and change the value of key.alias to your keystore's alias. Now when you run ant release, you will be prompted for your passwords, and the build will automatically sign and zipalign your package.

In your example above, you're using the same value for both key.store and key.alias.


The only other potential discrepancy I can see is that -release-nosign: is referencing build.properties when looking for key.store and key.alias, but referencing build.props later on.

I'm not an Andriod developer, so the best I can do is be a second pair of eyes; sorry.

Dave
  • 4,546
  • 2
  • 38
  • 59
  • 1
    I've updated my question to correctly reflect what the values are. I have x'd out the password for obvious security reasons. – Sheehan Alam Dec 24 '11 at 16:56