I hope someone can help me out with this problem. I am using an Ant Build to compile my java code but I get the following errors:
Buildfile: <PATH>
BUILD FAILED
<PATH>build.xml:55: sdk.dir is missing. Make sure
to generate local.properties using 'android update project' or to inject it
through the ANDROID_HOME environment variable.
Total time: 345 milliseconds
I am using eclipse.
Can't tell without seeing your build.xml file. However, the message looks very detailed. It says you need to generate a "local.properties" file, probably to set where sdk.dir is located.
In Ant, you can have a properties file that sets properties your Ant
build.xml
file uses. It says you can useandroid update project
to create this file. Again, it's hard to say without knowing what yourbuild.xml
looks like, what project you're trying to build, etc.A quick Google pointed me to this page.
There are two solutions to this problem, as described in the error message:
Set the value of the
sdk.dir
variable in thelocal.properties
file in the root directory of your Android project. This needs to point to the location of your Android SDK installation. For example, I have the following line in mine:sdk.dir=/usr/local/bin/android-sdk-linux
You can do this manually or use the
android update project
command to generate it for you.Alternatively, you can set the
ANDROID_HOME
environment variable in your.bashrc
file in your home directory. You can do this by adding something like the following line:export ANDROID_HOME=/usr/local/bin/android-sdk-linux
Note that you will need to source your .bashrc file or close your console window and reopen it.