Importing project gave Unable to resolve target ‘android-7’
When you try to import an already existing android project in your eclipse, sometimes you tend to get the error Unable to resolve target ‘android-7. This is simple and nothing wrong in your source file or your activity file. The problem is with the SDK version you have specified.
Let us consider I am setting my minimum SDK for my application as 7, so my project properties will have the line target=android-7.
Problem:
Now if you are trying to import this project in another system which doesn’t have API 7 then eclipse will throw an error, Unable to resolve target ‘android-7’
Solution:
To do this, you have 2 options:
- You can download API 7 for your application using SDK manager to run your application only on Android API 7. So you have to set your manifest file with the SDK version as follows.
<uses-sdk
android:minSdkVersion=”8″
android:targetSdkVersion=”8″ />
OR
- You don’t have the API level 7 downloaded. You can right click the project and go properties->android and select another available API. As long as you don’t change the min sdk version in your manifest you are still targeting as many devices as before.
<uses-sdk
android:minSdkVersion=”8″
android:targetSdkVersion=”15″ />
In the latter case, your application will run on any targeted devices with API ranging above 8 and till API 15.