Unable to resolve target 'android-16'
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.)
user1822729
Updated on December 09, 2020Comments
-
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 about 11 yearsThanks 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 about 11 yearsClean and rebuild your project? If this does not help you should open a new question with details about your new problem...
-
Will Vanderhoef over 10 yearsYou 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 over 10 yearsUnlike 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 over 10 yearsYou 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 over 10 yearsthanks :) I meet this problem when add android-support-v7-appcompat too :D
-
Bilbo Baggins over 10 yearsI had to change 17 to 18.
-
philant over 10 yearsYour answers will be much more appreciated with more formatting, esp. separate out the code from the text. Thanks
-
cjmling over 10 yearsThis helped me , after both top answer didn't help - -
-
Kapil Jituri about 10 yearsYou are a life saver !!
-
joey rohan about 10 yearsHelped me too.But why a bug has not been filed yet?
-
trukvl over 9 yearsThis 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 over 9 yearsThe best solution may be to install API version 16. I opted to have the compatibility library build against version 17 for now.
-
kert over 9 yearsOne 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 over 8 yearsthank you for this it really saves me a lot of time :)