No key.store and key.alias properties found in build.properties

JavaAndroidAntBuild Process

Java Problem Overview


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

Java Solutions


Solution 1 - Java

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.

Solution 2 - Java

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

Solution 3 - Java

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 ''.

Solution 4 - Java

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.

Solution 5 - Java

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 .

Solution 6 - Java

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSheehan AlamView Question on Stackoverflow
Solution 1 - JavaReuben ScrattonView Answer on Stackoverflow
Solution 2 - JavapinxueView Answer on Stackoverflow
Solution 3 - Javaasaf gitaiView Answer on Stackoverflow
Solution 4 - JavaDaveView Answer on Stackoverflow
Solution 5 - JavawyfView Answer on Stackoverflow
Solution 6 - JavalarryView Answer on Stackoverflow