Search code examples
javaandroideclipseandroid-4.2-jelly-bean

ClassNotFoundException: previously working Android Project


I had a working android project but needed to start from scratch. I copied all my source files and layout files over. There are no compilation errors but when I try to run, I get the following error.

11-27 17:21:56.793: E/AndroidRuntime(1450): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{projects.mobile.mapappproject/projects.mobile.mapappproject.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "projects.mobile.mapappproject.MainActivity" on path: /data/app/projects.mobile.mapappproject-1.apk

I am running eclipse juno and trying to run on Android 4.2. Thanks !


Solution

  • Rather than doing copy paste try following

    1.Create an android application project

    2.Delete the files which was created Eg.MainActivity and layout.

    2.Right click on project name and click import ,then from File system.Go to your project directory to import the source from there

    3.select that, then finish.

    4.Clean and build then run