ant cannot find pre_setup.xml for an Android project
I have started to have a play with Android programming and I got a basic project setup a couple of weeks ago and followed a tutorial from a magazine. I know that I managed to get the basic ant compilation to work but now I come back to it it fails with a slightly weird message:
$ ant debug Buildfile: /home/taft/android_code/countdown/build.xml BUILD FAILED /home/taft/android_code/countdown/build.xml:37: Cannot find /home/pete/android-sdk-linux_x86/tools/ant/pre_setup.xml imported from /home开发者_JAVA技巧/taft/android_code/countdown/build.xml Total time: 0 seconds
taft is my username; I have the sdk installed in ~/bin/ and my path is setup sensibly (I think):
$ echo $PATH /home/taft/bin:/home/taft/bin/android-sdk-linux_x86/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/taft/bin/android-sdk-linux_x86/platform-tools/
I don't have a pete user and I am not sure where it is getting this path from; line 36 & 37 of the build.xml looks like this:
<!-- Required pre-setup import -->
<import file="${sdk.dir}/tools/ant/pre_setup.xml" />
Now I am guessing that sdk.dir should be automatically populated by something... but I don't know what? Has anyone else run into this problem or have suggestions for what I can try next?
Make my comment an answer After much digging about I think I have fixed it
$ android update project -p .
I navigated into the project & fired off the above command which should update any projects. Running the command I got the following output:
$ android update project -p . Updated local.properties File build.xml is too old and needs to be updated. Updated file ./build.xml Updated file ./proguard.cfg
After that everything seems to have build fine again. I hope someone else finds this useful as I was stumped by this for about an hour (OK it was late last night, so I was not at my best).
精彩评论