8

I'm looking if someone else also got this problem, and if he found a source reason for it.

What happened is this:

I have dozens of different project. One of those was this project:

That I had once to help me. I didn't do anything with the project, aside importing it. That was couple months ago. I had Eclipse 3.7 at that point.

In the meantime I found out Eclipse Juno was out, and thought to try it. So I did, but later on due to couple different problems I decided to revert back for the time being. I found out the 3.8 version of Eclipse and so I gave it a go, and left my eclipse environment for a while.

Today I opened Eclipse as I wanted to do some work, and I found out over half of my projects(working projects) stopped working, and gave me this error or some similar errors:

05-18 19:53:01.672: E/AndroidRuntime(3939): FATAL EXCEPTION: main
05-18 19:53:01.672: E/AndroidRuntime(3939): java.lang.RuntimeException: Unable to instantiate activity 
ComponentInfo{com.example.android.bitmapfun/com.example.android.bitmapfun.ui.ImageGridActivity}:

Basicaly errors that had to do with ClassNotFound Exception. I said to myself, that's strange. I started investigating, and after couple of hours I found out something messed up my .classpath (build path) files. I downloaded the sample project again, and it's classpath file looks like so:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="gen"/>
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
    <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
    <classpathentry kind="output" path="bin/classes"/>
</classpath>

But my .classpath file in my local project looked like that:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
    <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="gen"/>
    <classpathentry kind="output" path="bin/classes"/>
</classpath>

I swear to God I didn't touch that project since I imported it a while back, and it was deffinetly in working condition back then.

Editing Build Path didn't work by itself. Even closing and reopening project didn't help. I had to restart eclipse as well, and only then, when I edited the .classpath file (or build path) it worked again.

Also I found out, that the export tab is not updated. For instance, if I add some library, it is added to dependencies, but in order for it's classes to be found at runtime, it has to be exported. I never (almost never) touched this tab, so it had to be "checked" automaticaly once I added different libraries, but now it seems it's not doing so.

I have no idea what did this, I hope it's not the Eclipse Juno, which had(has) some kind of a bug. Has anybody encountered this?

Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124
Lucas
  • 3,521
  • 3
  • 27
  • 39
  • 2
    It also happened to me once (probably after an adt update) that messed by workspace. I removed all the projects. Removed the Platforms, importes platforms, imported projects. That fixed it for me. – Gabriel Petrovay May 18 '13 at 21:30
  • Hi Gabriel. What do you mean by "removed all the projects"? You just removed them from workspace without deleting them on the disc? If so, what would it help? Second question what do you mean by "platforms". Which platforms do you reffer to? – Lucas May 18 '13 at 21:56
  • Yes, only removed them from the workspace. (Importing back did not work. So I went one step further). Removed project AND removed the platforms (`/Users/gabriel/adt/sdk`) because they were nor visible anymore under: Preferences -> Android. Then let the download manager download them again. Then imported projects back. Only now all the red markers for all the projects were gone. – Gabriel Petrovay May 18 '13 at 22:04
  • I see. My case was not that severe fortunatly, and also due to that I cannot use your hack, since my android preferences look ok. – Lucas May 19 '13 at 09:22
  • 1
    Make sure you have on Eclipse. Project-Properties - Java Compiler - Compiler compliance level - 1.6 – soynerdito May 19 '13 at 23:54
  • That's odd... I had 1.7 set. Thanks for the tip. Maybe that was the reason, but too late for me to verify, since I corrected all my .classpath files by now. – Lucas May 20 '13 at 07:59
  • 1
    your problem will be solved from – Narasimha May 24 '13 at 15:36

1 Answers1

1

I went to the complaining library and changed Project-Properties > Java Compiler > Compiler compliance level > 1.6 and that solved my problem.

Cote Mounyo
  • 13,817
  • 23
  • 66
  • 87