Unable to resolve target 'android-16'
Asked Answered
C

13

49

I am using Android 4.2.2. After installing the latest SDK, when I open the eclipse I could see all the projects having the problem during the build. Following is the error i get. Please let me know how to resolve this?

Unable to resolve target 'android-16'
Cherry answered 7/3, 2013 at 8:47 Comment(6)
Have you installed API 16?Burrow
I have installed the latest ADT and SDK and latest eclipse. How to check the versionCherry
in SDK manager, i could see Android 4.2.2 API 17 shown as installedCherry
In the same SDK manager, you'll have an option to install Android 4.0, aka API 16. Install that.Burrow
yup.. Could you please tell me how to make my existing projects to use API 17Cherry
@RaghavSood It's really annoying to see such condescendant people taking everyone but themselves for disabled idiots. People coming to this question OBVIOUSLY have it installed... Btw API 16 is 4.1, not 4.0.Poulter
C
73

I have had the same problem, after an update I got a similar error.

It can be fixed to manually edit the project.properties file and update the android-16 part to the latest one you have installed. In your current case that is android-17.

I guess it can be configured using Android ADT as well, but I could not figure it out and this was quicker

Furthermore, you have to update your manifest as well, make sure you have android:targetSdkVersion set to 17.

Chondro answered 7/3, 2013 at 8:56 Comment(9)
Thanks Veger. This solved the actual issue. but now my project is not able to handle R file. setContentView(R.layout.about); How to resolve this ?Cherry
Clean and rebuild your project? If this does not help you should open a new question with details about your new problem...Chondro
You shouldn't modify project.properties. # This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED!Honeydew
You are right, but at the moment of writing it was the only answer/way to fix this problem. The modification does not get reverted, even though the comment in the file indeed suggests so. Since there is another answer now, using the tools instead to provide a solution (which I did not test), it became a matter of preference between using the tools or directly edit the files (which obviously also done by the tools). As does seem to work for other people as well, I'll leave this answer be.Chondro
I had to change 17 to 18.Kelleher
This answer seems like a hack. Another answer worked for me: https://mcmap.net/q/349806/-unable-to-resolve-target-39-android-16-39. I'm guessing the initial properties for the compatibility library assume API 16 is installed. The setting is not updated until the user selects a different API version than the one that is checked by default (17 in my case). Once I checked 18 and closed the dialog the library built . Then I checked 17 again and everything was fine.Euclid
The best solution may be to install API version 16. I opted to have the compatibility library build against version 17 for now.Euclid
One more instance where you can run into this : your $ANDROID_HOME and the actual android tools executables ( aapt, android etc ) on the path are different. Eclipse picks them up from ANDROID_HOME, shell picks them up from path .. quick sanity check : ls -la which android $ANDROID_HOME/tools/androidHighspeed
thank you for this it really saves me a lot of time :)Hagberry
D
35

If you're using Eclipse, try changing the target build to something higher than API 17 (Right click -> Properties -> Android -> Project Build Target).

If that removes the error, just change the target build back to API 17 afterwards.

I had this issue when importing android-support-v7-appcompat, and changing the target builds back and forth fixed my problem.

Delibes answered 6/8, 2013 at 2:1 Comment(2)
Unlike the accepted answer this solved my problem. Cleaning the project won't solve the issue but strangely the back-and-forth toggling of build targets worked.Honeydew
thanks :) I meet this problem when add android-support-v7-appcompat too :DChronology
J
7

Worth noting:

My target in project.properties appeared to be set to target=Google Inc.:Google APIs:18. However, it seems that it was set somewhere else to 16. I had to change to target=Google Inc.:Google APIs:16, save, then save it back to 18, and then it worked.

Jaenicke answered 20/9, 2013 at 22:48 Comment(2)
This helped me , after both top answer didn't help - -Barquentine
Helped me too.But why a bug has not been filed yet?Essy
G
6

From the Android SDK Manager, install Android SDK Tools for API version 16.

Graticule answered 10/9, 2013 at 8:29 Comment(0)
B
4

Sometimes this happens even if the Project Properties and android:targetSdkVersion (in AndroidManifest.xml) are both of the same current SDK version.

If everything is current and matches, try restarting Eclipse. (This does actually work sometimes.)

Bighorn answered 25/1, 2014 at 22:1 Comment(0)
S
2

To resolve the problem of "Unable to resolve target 'android-16'" set the targetSDKversion for library project for example "android-support-v7-appcompat".

  1. Expand the library project
  2. Open manifest file from the library (not the one in your application)
  3. Under the tag specify the "Target SDK version" to version of SDK installed (example to 18)
  4. Rebuild the library and application ( or restart Eclipse)

That should solve it.

enter image description here

Spacesuit answered 4/12, 2013 at 18:56 Comment(0)
M
1

Also worth noting - Under Ubuntu 12.04, I installed the Android SDK Tools for API version 16, exited and restarted Eclipse and it resolved the issue without changing the target to version 16 and back to 18

Megalocardia answered 4/10, 2013 at 8:59 Comment(0)
L
1

Checked both projects project.properties files and they had version 18 as target, version 16 nowhere to be found. Restarting Eclipse somehow solved the issue.

Lanneret answered 22/10, 2013 at 13:20 Comment(0)
K
1

Unable to resolve target 'android-16'

Make sure which version your are using and set that version in the mentioned files

To solve this problem we need to change 3 files as follows.

project.properties (target=android-18)

AndroidManifest.xml (android:targetSdkVersion="18")

\bin\AndroidManifest.xml (android:targetSdkVersion="18")

As mentioned above the 3 files has the same version number.

Kerri answered 27/11, 2013 at 6:55 Comment(1)
Your answers will be much more appreciated with more formatting, esp. separate out the code from the text. ThanksIngenuity
C
1

In eclipse I did all the above and the error did not go away.

Then I simply RESTARTED eclipse and that solved it ;)

So, do the above and then restart eclipse!

Crutch answered 3/12, 2014 at 13:16 Comment(0)
Y
0

Go to project.properties in your project folder and change android:targetSdkVersion or target tag.

For example, if project.properties file contains android:targetSdkVersion=16 or target=android-16, change it to one of the targets which you have installed (you could check the installed target from Android SDK manager).

Yogi answered 17/9, 2013 at 10:27 Comment(0)
S
0

Set your proxy settings. sdk manager->options. then you can install the API you want. it worked for me.

Sloop answered 1/4, 2014 at 10:43 Comment(0)
V
0

Right click on Project. Go to Properties. Choose Android on the left site. On the right a you can see list of android API versions. Choose the proper version (android API 16). Click apply.

If you do not see the proper version go to windows. go to Android SDK Manager and download the android API 16 (Android 4.1.2). Repeat the steps as above.

In the below picture you can see API 16.If not found there, you can download API 16 using android sdk manager. If you already have click the check box next to android 4.1.2, click apply and then OK.

enter image description here

To download sdk form the sdk manager in eclipse go to windows, Android SDK Manager. You should see the following window and check android 4.1.2 which API 16 and click install.The below image is an example for API-15(you have to do it for API-16) enter image description here

Valiant answered 9/12, 2014 at 6:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.