Reputation: 4007
I want to set up a ant build for my project. I found a tutorial saying that I need to write the following command in order to prepare for ant build:
android update project -p
then I get the result
Updated local.properties
Updated file ./proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
so If I try
android update project -p . --subprojects
then I get:
Updated local.properties
Updated file ./proguard-project.txt
Error: The project either has no target set or the target is invalid.
Please provide a --target to the 'android update' command.
and if I try
ant release
I get
sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var
Can some one please help me in setting up the project with ant. Thanks
Upvotes: 8
Views: 17338
Reputation: 1610
I also had the same problem.
My problem problem got solved by the following command.
android update project --path . --subprojects --target android-19
ANT will automatically set your sdk.dir into correct one.
Don't put anything inside your local.properties.
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
Upvotes: 14
Reputation: 1555
Be sure to have a target set in your projects (main project and libraries as well).
on Eclipse: Right click on the project -> Properties -> Android and select your target SDK. This means the Android SDK version you are targeting. If you take a look in the manifest.xml, you should see that almost at the beginning:
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
This is the target version for your project, and usually is recommended to be as highest (newest) as possible.
After that, be sure that the file project.properties
has a line similar to this one:
target=Google Inc.:Google APIs:17
This file will be read by ANT to know the target of your project. You can add that line manually. Actually, I'm pretty sure that will be included automatically if you set the target for the projects in Eclipse (as I said above) before running android update project -p . --subprojects
About this error:
sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var
It means you didn't define the sdk.dir property, which should point to the android sdk root directory in your file system. After running android update project -p . --subprojects
it should be generated automatically for all your projects. It's possible that it wasn't due to the previous error. So check all your projects for the file called local.properties
and be sure that contains a line similar to this:
sdk.dir=/home/path/to/android/sdk/android-sdk-linux
Upvotes: 0