0

I use eclipse and have Android project that is specifically designed to be used by other projects. It is not a library, it is an Activity, and from other projects I want to extend that Activity.

So, I have my first project that goes like this:

public class MyGenericActivity extends Activity {
    @Override protected void onCreate(Bundle savedInstanceState) {
    // (...) and so on
    }
}

Now, keeping my first project open I create a new project.

In Eclipse, under Properties -> Java Build Path -> Projects I add the first project.

Now, after having automatically imported what I need, I can write inside the new project

public class MySpecificActivity extends MyGenericActivity {
     // (...) and so on
}

Eclipse does not give me any syntax error, but as soon as I run the project I get this:

09-02 22:54:00.217: E/AndroidRuntime(1003): FATAL EXCEPTION: main
09-02 22:54:00.217: E/AndroidRuntime(1003): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{<new project>/<new project>.MySpecificActivity}: java.lang.ClassNotFoundException: <new project>.MySpecificActivity in loader dalvik.system.PathClassLoader[/data/app/(...).apk]

What's happening? Is it a compile problem? A Java problem? I really cannot spot this. Thank you.

Beppi's
  • 2,089
  • 1
  • 21
  • 38

1 Answers1

1

I think you are ok while you are developing. Probably you have problems while deploying your app.

Take a look at: Eclipse Android project, how to reference library within workspace?

Community
  • 1
  • 1
Danilo Muñoz
  • 623
  • 1
  • 7
  • 17