293

I've been working with Eclipse 4.2 (Juno release 20120920-0800) on OS X 10.8.2 for a few weeks now, building apps for Android 3.0 and above. I have a quad core i7 MacBook Pro with an SSD, so performance is not an issue. Everything was fine.

At some point I imported an Android project that required Android 2.2, so I installed that using the Android SDK manager (v.21). Ever since then, working with Eclipse takes forever. First of all, it will print the following in the status message at the bottom right:

Android SDK Content Loader: (0%)

This takes two minutes or so. The specific message is "Check Projects" and while it's doing that, all Android projects are highlighted in red, because the Android resources aren't found. Then, it proceeds with:

Loading data for Android 2.2 (100%)

This will stay for a couple of minutes. Then it goes on to do the same with Android 3.1 and other SDK versions I have installed. It basically hangs whenever the first autocompletion kicks in (e.g. after typing System.) or when I access the Android preferences before it has loaded.

Here's the state of my Android SDK:

What I've already tried:

  • Reinstalling the Android SDK (via Homebrew), thus deleting /usr/local/Cellar/android-sdk completely.

  • Reinstalling the AVD plugin (v.21) from scratch.

What can I do to find out about the source of these problems and get back to a nice and clean state?

slhck
  • 36,575
  • 28
  • 148
  • 201
  • Are you supposed to have a `/r21` after your android-sdk location? Mine ends at `android-sdks`. – Matthew Quiros Nov 21 '12 at 08:33
  • Yes, that's normal for Android SDK versions installed via Homebrew. The SDK is found and loaded, it just takes forever. – slhck Nov 21 '12 at 08:36
  • I had same problem, I just clicked on Looding Content Loader and it will just solved.. also clean it first.. :) – Dharmik Nov 19 '14 at 07:42
  • take a look at http://stackoverflow.com/questions/15056987/android-sdk-content-loader-at-0-and-nothing-works/25833788#25833788 im sure it will help you – Dmila Ram May 06 '15 at 11:30

17 Answers17

566

This is the solution I found which works correctly:

  1. Make sure that eclipse is not active. If it is active kill eclipse from the processes tab of the task manager
  2. Open %USERPROFILE%/ on Windows or simply ~ on Linux/OS X (You can locate this folder from the Desktop)
  3. Go to .android folder (This may be a hidden folder)
  4. Delete the folder cache which is located inside .android folder
  5. Delete the file ddms.cfg which is located inside .android folder
  6. Start Eclipse

Hope that this will work for you.

slhck
  • 36,575
  • 28
  • 148
  • 201
roy mathew
  • 7,782
  • 4
  • 29
  • 40
209

Same problem, stuck at 0%. Ran

/Applications/eclipse/eclipse -clean

and everything worked great again. Modify that path for linux boxes.

Update (from the remark from @Janusz )

For mac users with eclipse outside application directory your clean command will looks similar to:

path/eclipse/Eclipse.app/Contents/MacOS/eclipse -clean 
hcpl
  • 17,382
  • 7
  • 72
  • 73
Tim O'Brien
  • 2,538
  • 1
  • 15
  • 13
  • I tried the solution you described but i couldn't resolve the problem. I had to delete the project under .project directory – FrancescoAzzola Feb 12 '14 at 12:11
  • The suggestion from laybackClimb to delete the stuff under .projects worked for me, BUT eclipse was not overly happy about it (numerous annoying errors).Eventually got eclipse happy again (deleted and re-imported some projects etc). I have not tested this 'eclipse -clean' options, but I suspect it might be a gentler approach. – demaniak Feb 24 '14 at 07:31
  • 7
    For mac users: If you have eclipse outside the application directory like me your clean command will looks similar to: path/eclipse/Eclipse.app/Contents/MacOS/eclipse -clean – Janusz Chudzynski Apr 18 '14 at 20:26
  • Didn't work for me, deleting the cache otherwise worked – A.S. May 20 '14 at 07:04
  • Yep. This is what you gotta do. I made a shortcut in windows to add "-clean" to the end of the path. Now when this happens I just run that shortcut, let it load, then I can close it and run eclipse normally. – Richard Jul 08 '14 at 19:11
  • in my case it worked using this command in Mac post cleaning cache as mentioned by roy methew. Alone this command was not working. Thx – Ajay Jul 17 '14 at 21:16
  • @TomislavTurcic : My eclipse setup directory is F:\android\eclipse and F drive is my main drive.So, shall i show the path in command line and run eclipse -clean? – shaon007 Jul 20 '14 at 05:42
  • 1
    Tried just about everything and nothing worked. Ended up just creating a new workspace and that did the trick – Will Jamieson Jul 30 '14 at 16:47
  • If it happens frequently enough for you as it does me, it's handy to remember to alias it in your ~/.bash_profile – Justin Godesky Aug 16 '14 at 05:07
  • this one seemed to work for me. Had the problem after trying to update my google services and librarys. – crushman Aug 17 '14 at 14:21
  • None of these suggestions worked for me. The solution was to obliterate the workspace, checkout my code from git again, and re-import the projects into the workspace. – Joe Lapp Sep 14 '14 at 17:20
103

Go to your workspace directory \workspace\.metadata\.plugins\org.eclipse.core.resources\.projects and delete all the projects in there.

Note: You are not going to lose your projects

vellvisher
  • 484
  • 4
  • 12
Mohamed Gamal
  • 1,348
  • 2
  • 13
  • 19
  • 2
    I have a complex workspace setup, and deleting everything from that folder caused Eclipse to lose its mind (unable to find my projects). However, restoring that folder to a previous state from my backup tool fixed the problem. – Scott W Jul 30 '13 at 14:33
  • 1
    Like @ScottW, Eclipse didn't like this. However, I removed all the projects and re-added them (via Git import) and it was happy again. – Rupert Rawnsley Sep 10 '13 at 14:42
  • 7
    This was very bad for me. I think the "eclipse -clean" suggestion is much better. – James Oct 15 '13 at 21:35
  • If Eclipse yells at you, delete projects from the workspace (not from disk) and then import them again. Worked for me after doing that – dsrees Oct 28 '13 at 22:31
  • This method will force all projects to be refreshed. and Also all SVN check out information to be erased. eclipse -clean is a way better solution. Also, it cause Periodic Save error on eclipse. I am glad that I would able to resort my deleted files from trash and use -clean option. – Clement Ho Nov 20 '13 at 19:10
  • I deleted some of my deprecated projects, not all, and solved this problem. This let me do not need to import working projects. – Longerian Jan 20 '14 at 05:28
  • _highly_ do not recommend this. Screws up a bunch of meta-data in Eclipse causing it to not load projects. Strange that this is the highest voted answer. – stevebot Mar 17 '14 at 20:14
  • 1
    You should not delete that directory without possibility of recover, because as @stevebot said, the projects and their plugins configs won't load (you lose even the version control configs for each one). You should, backup the .projects folder, start eclipse, let it load, then close it, and after that, overwrite the recently generated .projects with the one you backed-up. (Taken from here: http://stackoverflow.com/a/22007977/939781 ) – DNax Jul 31 '14 at 17:37
  • if you run this command with a workspace full of Android projects, be sure to reimport projects with 'Existing Projects into Workspace'. If you try 'Existing Android Code Into Workspace', you will get an error – Danedo Sep 08 '14 at 17:28
  • Not recommended. Meta data may got lost. Additionally if you are using TFS/SVN it then related data got deleted too. – Vishal Oct 07 '14 at 10:13
  • If you have projects linked to SVN, do NOT do this step. – AWT Dec 15 '14 at 15:07
  • +1, after wasting one day to stay on safe side and too not get any mess with eclipse, I just tried and worked for me. Note: Git projects will be no more in a connection with remote repository – Muhammad Adil Feb 19 '15 at 06:44
56

I have used some other answers here to fix this problem but I came across it again recently, and none worked. I didn't want to re-install or delete my workspace, so I finally found one that did work that might help someone else. Delete the file:

/workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi

You can make a backup first, if you like. It stores your workbench settings (perspective state, file paths for menu options, etc.) But eclipse loaded and I didn't have to re-install anything like some answer suggest. And I haven't seen this anywhere.

Jim
  • 10,172
  • 1
  • 27
  • 36
  • 3
    All solution just worked one time, and after restating the eclipse sane story. But this solution fix the problem permanently. thanks – M. Reza Nasirloo Jul 08 '14 at 11:58
  • 1
    Though the clean solution works for me sometimes, this one is far more reliable, thank you. – Justin Godesky Aug 16 '14 at 05:24
  • This worked for me too. My set up is OS X 10.8.5, Eclipse 4.2.1 – SundayMonday Sep 17 '14 at 18:48
  • This was the easiest way for me (especially since I've had to do it multiple times now). I do have to reopen my expressions tab but that's no biggie. – codeMagic Oct 01 '14 at 13:55
  • This worked for me, seems the easiest solution. Thanks. Set up: Windows 8.1, Eclipse 4.2.1, ADT 22.3.0. – Mehdi Oct 15 '14 at 02:55
  • to make it more easier go for the terminal way on mac.execute: `cd /Users//Documents/workspace/.metadata/.plugins/org.eclipse.e4.workbench rm -f workbench.xmi` – Nezam Nov 13 '14 at 14:19
  • roy mathew's solution worked once for me but eclipse stucks again after reboot. This solution works great for me and could survive after reboot. – user1129812 Dec 08 '16 at 00:48
27

I know that this has been resolved but I thought I would share this link:

Solution One

Often times, this problem can be network related. Check if your network is behind a proxy. If so, you need to configure proxy on Eclipse. For that, go to “Windows” -> “Preferences” -> “General” -> “Network Connections”, and fill in your proxy info. Restart Eclipse after that. Conversely, it’s also possible that you have configured proxy on Eclipse before, but that you are no longer behind proxy. Make sure to disable proxy then.

Solution Two

Another solution is to clean up project-specific meta data directories which are stored under your workspace directory.

$ cd workspace/.metadata/.plugins/org.eclipse.core.resources/.projects
$ rm -rf *

Restart Eclipse.

Solution Three

Check if an adb process is running. If so, kill the adb process, and restart Eclipse.

Solution Four

  1. Try deleteing the contents of the cache folder located in user profile under .android\cache
  2. Try deleteing the ddms.cfg located in user profile under .android
slhck
  • 36,575
  • 28
  • 148
  • 201
cking24343
  • 3,173
  • 1
  • 21
  • 23
  • I follow "solution Two", it helps to open Eclipse, but looses all SVN setting – Nezneika Jan 15 '14 at 10:40
  • Update: The .svn folders of all projects actually still exist, so I open Eclipse, choose Project>Team>Share Projects. Then its display message "Project is already configured with SVN repository", click Finish to re-connect SVN setting. "Solution Two" solved my problem, thanks @cking24343. – Nezneika Jan 16 '14 at 04:29
22

All the other solutions did not work for me so I simply deleted all the .log files inside the folder [workspace]/.metadata and it worked again!

eeadev
  • 3,662
  • 8
  • 47
  • 100
7

It turns out this problem indeed occurs when your internet connection is flaky, slow, etc.

As soon as I got back to my normal internet connection, the content would load fine again, within less than a few seconds.

slhck
  • 36,575
  • 28
  • 148
  • 201
  • 1
    My connection is fast enough but still having issue , i just tried http://stackoverflow.com/a/15635287/501483 and all works great ! – dharmendra Jun 20 '13 at 05:44
7

I have tried all the solution but i didn't get solution. After that i have disconnected Internet and deleted ddms.cfg from .android folder -> open eclipse -> dialog of statistics send to Google? -> Selected NO and Finally Worked for Me.

Edited:

I have tried eclipse -clean command in Command Prompt and that also worked for me.

Note: For eclipse -clean command first you have to select path of eclipse folder where you have placed.

Thanks.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
3

I'm on a Mac and using ADT, can confirm that the following worked for me.

cd workspace/.metadata/.plugins/org.eclipse.core.resources/.projects
rm -rf *

No amount of restarting the Eclipse, or rebooting the Mac was helpful. It seems that Eclipse gets into this stage because of stopping abruptly. I had to force boot my Mac and this issue seems to be happening since then.

slhck
  • 36,575
  • 28
  • 148
  • 201
codeFood
  • 1,241
  • 16
  • 16
2

My solution:

Install all the Docs in the sdk manager.

ragzz2014
  • 56
  • 5
  • I think it would be better to actually solve the problem. This seems just like a workaround. – Johan Karlsson Dec 06 '12 at 12:38
  • Do you think this is related to Internet connectivity or speed? Back when I had this issue my connection was very flaky, but now it seems to be better again and Eclipse doesn't hang anymore – slhck Dec 06 '12 at 14:13
  • i think it's a connection problem, i just solved it by install all the Documentation for Android SDK in Android SDK Manager. – ragzz2014 Dec 06 '12 at 14:51
2

I prepared little script to make it easy dealing with this reoccuring and very annoying problem. Open Terminal, then:

open ~/.bash_profile

at the end of the file paste this function:

function eclipse-clean() {
  echo "removing ddms.cfg file" 
    cd ~/.android/
    rm ddms.cfg 
  echo "removing cache"
    cd cache/
    rm -rf *
  echo "done! you can open eclipse now."
}

then all you have to do now is:

source ~/.bash_profile

and whenever you are stuck just type in Terminal window:

eclipse-clean
RafalManka
  • 366
  • 5
  • 14
2

just right click on eclipse and run it as a administrator i was also having the same problem after this it was working fine actully sometimes the windows do not give the permission to access to sdk in normal user so you have to give admin permissions in order to work android sdk or content loader

this approach:

shut down eclipse then go to YourWorkSpace\.metadata\.plugins\org.eclipse.e4.workbench and remove "workbench.xmi", now restart eclipse.

vikas aggarwal
  • 468
  • 3
  • 9
1

I made this batch file to fullfill the task explained by slhck's answer for Windows systems:

@echo off
set ECLIPSEFOLDER=%CD%
cd /D %USERPROFILE%/.android
rd /s /q cache
del ddms.cfg /f
cd /D %ECLIPSEFOLDER%
eclipse -clean -refresh
exit

I explained such approach in this post on my blog.

Darkseal
  • 9,205
  • 8
  • 78
  • 111
0

All the above solutions didn't work for me.

In eclipse Under Problems Tab check errors- You might see the unable to delete file and project path name.

Now Go to your workspace directory - Check project.properties for all the project stated under problems tab and check

target=android-21

The target value is valid and exists in your android-sdk/platforms/ folder

In my case target=Google,Google-Api-16 was causing the issue. Replace that and it solved.

Fenil
  • 1,194
  • 10
  • 11
0

Worked! All I did was to open Terminal and typed:

    cd documents/workspace/.metadata/.plugins

and then... typed

rm -rf

... in that .plugins category.

itzo
  • 1,220
  • 14
  • 18
0

There are various reasons for this problem, and each have a different solution. For a Linux environment, I made a alias to take care of most of these as they happened overtime. To have all of those in one place, you could try this:

  • Add the following in your ~/.bash_aliases file.

    alias eclipse='rm -rf ~/.android/ddms.cfg;rm -rf ~/workspace/MyApps/.metadata/.plugins/org.eclipse.core.resources/.projects/*;mv ~/workspace/MyApps/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi ~/workspace/MyApps/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi.bkp;rm -rf ~/.android/cache/;cd ~/Desktop/adt-bundle-linux-x86_64-20140702/eclipse;nohup ./eclipse & cd -;'
    
  • Refresh source using source ~/.bash_aliases

Note:

  • ~/workspace/MyApps is my workspace, you'll have to configure your's accordingly.

  • ~/Desktop/adt-bundle-linux-x86_64-20140702/eclipse is the location of my eclipse executable,and you'll have to configure your's accordingly

Sandeep Kaul
  • 2,957
  • 2
  • 20
  • 36
-1

So this is what got me working again:

Resolved the problems with the different versions related to android-support-v4.jar. They were mismatched which causes problems if projects are related anyway.

The second one is not that obvious: I restarted the IDE from the shell, providing the $ANDROID_SDK_HOME - Environment variable. This got me a step further but the ide hangs on a different location. Providing $ANDROID_HOME finally got me all the way up again.

BTW: After this procedure it was not necessary in following starts of the IDE to set the environment variables again.

slhck
  • 36,575
  • 28
  • 148
  • 201
Peter
  • 1,769
  • 1
  • 14
  • 18
  • 1
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). – plaes Sep 21 '13 at 12:31