ezhil
ezhil

Reputation: 2606

Error:Unable to resolve target 'android-2'

[2011-02-10 00:14:34 - newproject] Unable to resolve target 'android-2'


and the newproject java and xml files does't have an any error but the project is in error from when i import what problem in it


Upvotes: 10

Views: 31627

Answers (4)

Alon Catz
Alon Catz

Reputation: 2530

I've just had this problem. The fix is simple - restart Eclipse. The reason is a bit more complicated:

  1. I had a fresh install of Eclipse and android SDK v.17 (4.2.2)
  2. I downloaded and imported source code (ActionBarSherlock) which had target=android-14 in it's project.properties file.
  3. Eclipse figured out that I use android-17 and updated project.properties to target=android-17, BUT, eclipse still had target=android-14 cached somewhere in its workspace's .metadata folder and was using the cahced version during the build

Restarting eclipse solved it.

Upvotes: 4

Oskytar
Oskytar

Reputation: 205

Also be aware of SDK version if importing an existing project, because project.properties will be also imported as well.

If you're running Android SDK Manager in Windows, you can access SDK Manager.exe program to check which SDK versions are installed. This program is usual

Upvotes: 0

Vikas Patidar
Vikas Patidar

Reputation: 43349

Problem is not in your Java or XML code. You have to change the target in your default.properties file in your project.

Here you have to change the following line:

target=android-2

Here the digit 2 represents the API level of the Platform you want to run your application.

So use the value of the API you want to run.

Like if I run my application on Android 2.3 then I use target=android-9

Refer : API Levels

Upvotes: 23

Raoul George
Raoul George

Reputation: 2797

You can change the target version of Android by right-clicking your project, navigating to Properties and then clicking on the "Android" tab as shown here.

enter image description here

Upvotes: 12

Related Questions