Android error in eclipse: Unable to resolve target 'android-xx' - android

I know there are some sort-of duplicates of this, but none of the answers have been able to help me so far.
In a project shared with some friends over SVN, I always get the following error:
Unable to resolve target 'android-10'
When I change project.properties to alter the target version, the error message will remain, unless I use android-16.
I have checked my project's Android sessions to see if I could change the target there, but it only gives me 16 and 17 as options.
In my SDK Manager, I have the entire "SDK 10" branch installed, as well as several others.
Does anybody know what may be the problem here?

Another method is not use the same SDK, but use the SDK in your computer.
Right click project and select Android ,check target name, click 'apply' and 'ok'.
Then Right click project -> Android Tools -> Fix Project Properties.
Clean and build the project.

This answer is way too late but for anyone experiencing the same problem, try installing API 10 from the SDK Manager. Then run everything as you did before.
Or if you're on a Windows OS, this might also help: http://sagistech.blogspot.ca/2010/05/android-sdk-error-unable-to-resolve.html

If you're not getting android-10 as an option in the properties view, then clearly there is something wrong with your installation.
Well, the obvious thing to do is to doublecheck that the SDK location in Window >> Preferences >> Android is set up correctly and pointing to the right installation of the ADT. If so, the view in preferences should also include SDK10 as one of the installed platforms (in which case, there really shouldn't be any problem).
If it doesn't, something has gone wrong - either in Eclipse or the ADT installation. I would check - just to be sure - that you have the right Java SDK - I've had problems with Eclipse/ADT myself when this is the case.
If those two things seem in order, though, the best advice I can give is to reinstall eclipse and the ADT both. If you only use the installation for Android, then I'd suggest using the "official" Google Eclipse package from developers.android.com.
Unless you have a lot of stuff set up in your eclipse environment that would be pain to change, I wouldn't recommend spending time on trying to identify whatever variable is messed up (speaking from painful experience here ;) ).

While importing project tick the checkbox "Copy Project into workspace" after selecting projct. Hope this help you, as this option fixed for me.

Related

Showing Error in all projects: ADT Bundle

I am using ADT bundle for my Android Application Development
1) From last two days whenever I open my ADT bundle its showing error in all the projects (But I have no errors in my projects and I am sure about it). I tried to clean all the projects but no use... Sometime a restarting eclipse will solve this problem but after few days I am getting this same errors again.
2) Also In my Android SDK Manager some packages like Google API and system images in extras were broken, I don't know what to do.
I tried to clean my projects and to update the SDK manager but nothing solved my problem. Kindly tell a better solution to solve this problem. And tell me why these kind of errors are happening.
Thanks a lot in advance.
But for this kind of problems need more clarifications. Here is my few tips to resolve it. It may or may not work! But better give a try.
In each class or java file which place exactly it showing the error? For example for few it will sow error in R. file and the error will be R cannot be resolved into type. If you are getting this error try to import you package R. file (Like import com.example.R) will resolve issue. If you couldn't import then try to check the package name in manifest file and other layout files. Try to resolve all errors one by one in res folder then clean will help it.
Next check whether Eclipse issue or ADT issue. You said few things are broken in ADT i don't know what exactly it means but try to uninstall and re-install them again.
Try to update eclipse. You can do it by Help->Check for updates
If nothing helps follow the error which are displayed in Problems tab which present near console tab. Otherwise open it here Windows->Show View -> Problems.
Hope anyone will help you if not please follow the errors and edit your question with error. So you might get better answers!
I had the same trouble.
I completely remove Eclipse and SDK bundle; then, i re-install everything.
This worked for me.
Do check this, Lint Error Checking will slow your ADT also seems to be occur error like what you got in a often situation..
so Disable lint from Windows-> Preferences -> Android-> Lint Error Checking, Under
Uncheck the two option in right hand side.
Be aware of what all your projects have JDK compliance.. set common JDK level.. mostly 1.6 based on need change to 1.7 for all projects..
set JDk compliance level in properties of your project -> java compiler and select in right hand side..
Always Check when importing any projects after import if its came up with a compatibility library or external library to be added like appcompat_v7
Check in properties of project under android tab in library section if there is any missing files..
From all the above suggestions are not fulfilled your problem, then go ahead with a new fresh latest ADT Bundle with a fresh download of platforms of SDK.. it will solve most of the ADT problems..
Finally the problem solved
This problem occurred due to missing target SDK in project properties and because of the broken files in SDK manager.
What I did is:
1) I deleted all the broken images and Google api packages from the SDK manager and I re installed all the packages again,
2) Then I selected android 4.2 as the Android Build Target in the project properties.
Thanks all for the time and help.

Updated eclipse, every single project broken

http://puu.sh/3oa21.png
See above, 119 errors in total, every single project has been broken and everything is undefined, including inconsistent 'hierarchys of type'new projects dont have this problem.. :/ at my last tether please help!
http://puu.sh/3oa21.png
Updating my ADT helped me when I had the same problem:
How to Update your ADT to Latest Version
In Eclipse go to Help
Install New Software ---> Add
inside Add Repository write the Name: ADT (or whatever you want) and Location: https://dl-ssl.google.com/android/eclipse/
after loading you should get Developer Tools and NDK Plugins
check both if you want to use the Native Developer Kit (NDK) in the future or check Developer Tool only
click Next
Finish
Edit:
Did you try restarting your PC? adb.exe (and maybe other background services) might need to be restarted
if you take a look at your build path for your project you will probably see errors in it right?
What you need to do it change the order of the build path and make sure all boxes are checked.
I had to change my order to src/Android Private Libraries/SDK version/Android Dependencies/gen in that order
see here also
Libraries do not get added to APK anymore after upgrade to ADT 22

Android Hello World in IntelliJ 12 - Cannot find android.app.Activity class

Please see below. I have a feeling I've got the SDKs configured incorrectly, but I'm not sure how to solve it. I tried Googling for answers but no one had this exact problem.
Do I have the wrong Java version maybe? It seems like the two SDKs might be conflicting with each other.
I made this project via:
Create New Project
Android > Application Module
Defaults and Finish
Edit: See screenshot. I got it working. All I did was create a new project and re-select the Android SDK. I'm still thinking it was because I added too many SDKs/JDKs the first time. I think all you need is the Android SDK and don't need to add the normal Java one too.
I tried what for3st suggested to no avail at first, but i've heard other places that you should use JDK 1.6 for IntelliJ IDEA in other places, so you can do that here. Also, you set the SDK by going 'File'->"Project Structure" -> "Platform SettingS" -> "SDKs"
In the end, I also switched from Android 2.2 to 2.3.3 (api 10) and that got it to work. Don't have a good idea why it didn't work for 2.2, but since I just want a beginner's tutorial, I'm fine with that.
I had exactly the same problem, but the conditions leading up to it are quite unusual.
I downloaded the Android SDK as a zipfile and unextracted it into /opt.
However, the permissions did not allow normal users to enter all directories or execute all files... so when IntelliJ indexed the SDK it only picked up the res jar... and never added the sources to the library path!
Deleting the SDK, fixing the permissions problem in the SDK, and creating a new reference in IntelliJ fixed it.

Eclipse cannot find Android Support Library

I am an experienced programmer but new to Android, hence using Eclipse for the first time.
Unfortunately I cannot get my first project off the ground. I get as far trying to create the project when the following sequence happens.
A screen arrives titled 'Install Dependencies' telling me that the required version is 8 and the installed version is 'Not installed'
I click on the Install/Upgrade button and something must happen because Android SDK Manager pops up and I get a whole series of 'Fetching:' messages.
The next screen asks me to Choose Package to Install and the only option is Android Support Library, revision 10. This doesn't bother me as I presume 10 is better than 8 so I hit the Install button.
This is where it all goes wrong as I get a red message saying:-
File not found:C:\Program Files (X86)\Android\android-sdk\temp\support_r10.zip (Acces is denied).
Sure enough, when I check this folder, it is empty.
Now, something must have happened as as SDK Manager did a whole lot of fetching and must have put these files somewhere.
I am quite happy to find them and put them in the correct folder but the question is
What is the name of the files that I am looking for?
Run SDK Manager as administrator and then install Android Support Library from Extras
Download the sdk manager seperately and install files from there. put it in a place which is accessible to you and then point your eclipse android directory to it. tools>options>android sdk
Run eclipse as Administrator. This is the solution.
Try running your application (Eclipse) in Admin Mode.
Right click on the Eclipse app, and choose "Run as Administrator"
This will fix your problem.
properties >java build path >click library tab > add jars > add jars from the support library.

Why is my updated Eclipse / Android setup not building my APK anymore?

I had a working Eclipse setup with 3.6.2 and SDK tools from version 11, and it has been building my main project just fine for quite a while.
For a different project, I thought I needed to upgrade my SDK to the latest and greatest - at this point API 14 (ICS 4.0).
I cannot even reconstruct the steps I went through, but what happened was that my project would seem to build, but I would see that it would say that it was skipping a post-compiler step, and at the end I would have no APK.
I also noticed that it updated my .classpath so that the output path was bin/classes instead of .bin.
Along the way I tried updating my Eclipse to the latest version (Indigo 3.7.1) but this didn't help.
I solved the problem eventually with help from this post on the Google Android forum:
http://code.google.com/p/android/issues/detail?id=21031
For me personally the biggest issue seemed to be solved as follows (qutoe from comment 25 in the forum post)
"I seem to solve the problem with .apk files not being built automatically until run/debug is used (comments #10, #11 etc.). Go to Windows -> Preferences -> Android -> Build and uncheck "Skip packaging and dexing until export or launch" then restart Eclipse. Works for me."
But there is other useful material there. Different people with different projects seem to have different problems with this setup.
I still don't understand the change in the classpath, but it doesn't seem to matter.
In addition, I found a discussion of installing the ADT with Eclipse Indigo which was helpful here in Stackoverflow:
Eclipse Indigo - Cannot install Android ADT Plugin
I also found that I guess because of various uninstalls/reinstalls, for some reason it stopped excluding my .svn directories from the sources. This Stackoverflow post was helpful with that:
Why is eclipse trying to copy my .svn folders from src to bin, and how can I make it stop?
Finally: a tip for really and truly uninstalling Eclipse - everybody says there is no uninstall, and there isn't, but there is a directory that Eclipse leaves in your home directory (in windows 7 under c:\users\) called .eclipse -
Zap it if you really want to start fresh.
In addition, for less extreme measures, there is Project->Clean inside Eclipse, and you can invoke eclipse with "eclipse -clean" for additional cleansing effects. No idea what, but various helpful people along the way suggested trying that to solve problems.
Ah yes - when I first installed Indigo and tried to build, I got a warning that my Java Compiler Compliance level was not up to snuff, which was simply not true - I have only Java 1.6 installed on my machine.
See this post for somebody who had similar experience:
http://marakana.com/forums/android/general/374.html
For me, what worked was simply going to Project, Properties, Java Compiler, then click on Configure Workspace Settings, and click on Ok in the dialog. Didn't need to actually change anything. Just showed it that everything was ok!
Eventually I indeed did clean out my Eclipse and Android installations (including the aforementioned .eclipse directory, and there's also an .android directory in your home directory which you may want to erase if uninstalling the Android SDK Tools doesn't do that - this actually is uninstallable). Installed everything from scratch and then used the additional information provided above and now it's building my APK.
I hope this saves somebody the hours I spent getting my build back in shape.

Categories

Resources