I get this error when I do
$ ant release
sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var
typing in android update project I get another error saying I must specify the path .... to the project.
Then I try cd into the directory of my project and do
android update -p .
android update -path .
etc and it says -p
and -path
are not globally recognized.
Could someone just give me the exact syntax?
Yeah, none of these solutions worked for me. This did from here:
Setting ANDROID_HOME enviromental variable on Mac OS X
Open the terminal window and enter the following (I hope this is the complete path to sdk):
export ANDROID_HOME=/Applications/ADT/sdk Once you have this set, you need to add this to the PATH environment variable
export PATH=$PATH:$ANDROID_HOME/bin
You can use
sdk.dir
in projet.properties file to define the sdk home or use an environment variable (more flexible for team work).I had the same problem. After flailing around with the command line commands for a few minutes I ended up just editing the
local.properties
files directly.You should have a file called local.properties within your
folder. If you don't have one then you can create it.
Within the file there should be a reference that specifies where ant can find your android sdk. It should look like this:
Just update your details to point it to your correct android sdk folder.
The double \ are present in my file. Not sure why but it seems to work. :)
Note: this file also needs to be copied into your
CordovaLib
folder, which is one folder deeper:<app-directory>\platforms\android\CordovaLib
That should create/fix the local.properties from ant:
name parameter is optional
target is the api version
More info here https://developer.android.com/tools/projects/projects-cmdline.html#UpdatingAProject
cd to project directory and execute the following: The word project is part of the command, and is not to be replaced with an actual project name. The documentation does not make this clear and should be improved.
You can inject the
ANDROID_HOME
environment variable into thesdk.dir
property using the followingant
command.ANDROID_HOME
must be an absolute path such as/Users/jameswald/Development/android-sdk-macosx
.