-2

Something that really irritates me while developing apps is eclipse suddenly throwing random errors. Below are some of them.

Not being able to recognize Java libraries

Error: Import error, Can not resolve java.** Solution: Clean projects and then restart eclipse.

Not being able to recognize reference libraries

Error: Multiple related errors This is probably something that bothers the me most. I have libraries such as Google play services, appcom v7 etc that I use together in various apps. These libraries are locally saved on my computer.

Solution:

Small fix: clean projects -> restart eclipse

Major fix: To fix the resolution error I have to copy the library rename it and then make that new library a reference/support to my project again.

R can't be resolved

Solution: Multiple solutions

Way 1: Sudden package name not being recognized. Go to manifest file and fix name.

Way 2: Check if R file even exists. Clean projects.

Way 3: Check if you are missing any necessary imports. Might cause the R file to be hidden. Might be related to the previous problems.

What I want:

Is there any way to practically solve these errors once and for all. My computer is really crappy and takes forever to restart eclipse and launch the emulator. This is a really embarrassing event especially if I want to present to my colleges or something and I have to wait for eclipse to restart.

Thanks in advance.

Community
  • 1
  • 1
SeahawksRdaBest
  • 868
  • 5
  • 17
  • 1
    I think to fix them you'd need to find the bug in eclipse and fix it there (eclipse is open source). Do it and you'll be my personal hero, if that's any extra motivation :) – Gabe Sechan Jul 13 '14 at 02:58
  • @GabeSechan lol its so irritating!! Its a constant battle with eclipse. – SeahawksRdaBest Jul 13 '14 at 02:59
  • I get most of these issues with Eclipse too, especially when Eclipse suddenly hates Maven. I've had to restart Eclipse many, many times until it's happy. – Unihedron Jul 13 '14 at 03:00
  • Which version of Eclipse are you using? I'm actually inclined to believe these are bugs in the Android plugin. Have you tried using Android Studio? – d3dave Jul 13 '14 at 03:01
  • Eclipse sure is nice, and there's lots of reasons one would probably want to use it, but have you considered another IDE such as IntelliJ? – Ryan J Jul 13 '14 at 03:02
  • @Unihedron dosn't that piss you off?! it's such a trivial problem but no where can I find a reasonable solution!! – SeahawksRdaBest Jul 13 '14 at 03:02
  • @RyanJ I know eclipse inside and out. So I don't really want to change and learn a new IDE – SeahawksRdaBest Jul 13 '14 at 03:03
  • @RyanJ I wouldn't object to switching to a new IDE, but that solution sounds equivalent to getting a better computer so Eclipse restarts takes less time. I'd still like to see relevant, helpful answers, if any. :) – Unihedron Jul 13 '14 at 03:09
  • @SeahawksRdaBest I don't have a good answer. I've actually been using Intellij for years, so the Android Studio switch wasn't exactly difficult for me ;) The bad news is I'm pretty sure there won't be much in the way of new fixes for eclipse/android plugins, and anything new is pretty much in studio/gradle (and I hear Wear requires it, but don't quote me). – Kevin Galligan Jul 13 '14 at 03:52

3 Answers3

2

Many of your problems could actually be caused by your "crappy computer":

  • If your Eclipse doesn't have a large enough heap, then it is likely to be sluggish (in general).

  • If Eclipse runs with a heap that is too small, you could get OOMEs that Eclipse is unable to recover from properly. (They will probably show up in the eclipse log file.) This kind of thing could manifest as "random errors" due to breakage to Eclipse data structures.

So, a couple of practical things you could do are to give Eclipse a larger heap, and to get a machine with more RAM.


Increasing the max it can use to about 2GB. This helps initially but slows down as well.

This is a sign that you actually need more physical RAM and / or a 64-bit operating system.

You are probably putting your machine into a state where the memory page "working set" of the stuff you are running is larger than the physical memory available to hold it. The virtual memory system tries to address this by "paging"; i.e. swapping virtual pages between disc and RAM. But the result is that your machine becomes increasingly sluggish.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • First good answer!!.I have tried giving eclipse more ram. Increasing the max it can use to about 2GB. This helps initially but slows down aswell. I then try to help eclipse out by clearing my cache. But this is like doing a bypass surgery to a dieng patient if you get the analogy lol. – SeahawksRdaBest Jul 13 '14 at 05:33
  • This is what i use to clear the cache btw. http://www.unixmen.com/how-to-clear-memory-cache-on-linux-servers/ – SeahawksRdaBest Jul 13 '14 at 05:33
  • I think this is a really helpful advice, as I've installed many plugins on my Eclipse work setup and never really allocated more RAM than from the vanilla Eclipse installation specifications. Now it's running decent. – Unihedron Jul 13 '14 at 05:37
  • @Unihedron you learn something new every day lol. http://stackoverflow.com/questions/15313393/how-to-increase-heap-size-in-eclipse – SeahawksRdaBest Jul 13 '14 at 06:08
  • I understand the additional ram helps part but why would having a 64 bit OS help vs 32 bit? – – SeahawksRdaBest Jul 13 '14 at 06:18
  • 1
    Because a 32bit OS limits the size of the Java heap. – Stephen C Jul 13 '14 at 07:13
0

I would try to uninstall (Be sure to keep all of your project files backed up). Then download the latest version and install. Also, if you have a slower machine Eclipse is very intensive and it might just not run well on your computer all together.

Caleb L
  • 139
  • 1
  • 9
0

You just update ADT to respective SDK version. Or check both version are compatible. I was faced same problem last week.

Sandeep
  • 766
  • 5
  • 16