I want to check whether my app uses any object/method that does not exist on Android 1.5 (=API level 3), so I wrote in AndroidManifest.xml:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="3"/>
… then I ran ant clean debug and:
PROBLEM: Ant still uses the highest SDK level I have installed (11), not the one I want (3):
-setup:
[echo] Gathering info for AnkiDroid...
[setup] Android SDK Tools Revision 15
[setup] Project Target: Android 3.0
[setup] API level: 11
You also have to set the target SDK for your project.
There are multiple ways to do that
In Eclipse
Right click on the project in eclipse, go to properties -> android and select a target SDK from the list.
Via the command line
Use
android update project -t <targetID>as described here, where<targetID>is one of the target ids that you get listed by executingandroid list targets.You can see the current target in the
project.propertiesfile in your project folder, it should have a line like this:(it might also work to edit this file directly. I’m not sure though, so if you try that, be prepared and have a backup, expect things to break, etc. 😉 )