Unable to resolve target 'android-16'

87,847

Solution 1

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.

Solution 2

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.

Solution 3

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.

Solution 4

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

Solution 5

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.)

Share:
87,847
user1822729
Author by

user1822729

Updated on December 09, 2020

Comments

  • user1822729
    user1822729 over 3 years

    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'
    
  • user1822729
    user1822729 about 11 years
    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 ?
  • Veger
    Veger about 11 years
    Clean and rebuild your project? If this does not help you should open a new question with details about your new problem...
  • Will Vanderhoef
    Will Vanderhoef over 10 years
    You shouldn't modify project.properties. # This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
  • Will Vanderhoef
    Will Vanderhoef over 10 years
    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.
  • Veger
    Veger over 10 years
    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.
  • hqt
    hqt over 10 years
    thanks :) I meet this problem when add android-support-v7-appcompat too :D
  • Bilbo Baggins
    Bilbo Baggins over 10 years
    I had to change 17 to 18.
  • philant
    philant over 10 years
    Your answers will be much more appreciated with more formatting, esp. separate out the code from the text. Thanks
  • cjmling
    cjmling over 10 years
    This helped me , after both top answer didn't help - -
  • Kapil Jituri
    Kapil Jituri about 10 years
    You are a life saver !!
  • joey rohan
    joey rohan about 10 years
    Helped me too.But why a bug has not been filed yet?
  • trukvl
    trukvl over 9 years
    This answer seems like a hack. Another answer worked for me: stackoverflow.com/a/18070674/700204. 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.
  • trukvl
    trukvl over 9 years
    The best solution may be to install API version 16. I opted to have the compatibility library build against version 17 for now.
  • kert
    kert over 9 years
    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/android
  • Kairi San
    Kairi San over 8 years
    thank you for this it really saves me a lot of time :)