1

when I try to start my App I get the following error:

05-21 16:51:58.081: E/AndroidRuntime(8873): FATAL EXCEPTION: main
05-21 16:51:58.081: E/AndroidRuntime(8873): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{de.foodev.myApp/de.foodev.myApp.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "de.foodev.myApp.MainActivity" on path: /data/app/de.foodev.myApp-2.apk
05-21 16:51:58.081: E/AndroidRuntime(8873):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at android.os.Looper.loop(Looper.java:137)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at android.app.ActivityThread.main(ActivityThread.java:5041)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at java.lang.reflect.Method.invokeNative(Native Method)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at java.lang.reflect.Method.invoke(Method.java:511)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at dalvik.system.NativeStart.main(Native Method)
05-21 16:51:58.081: E/AndroidRuntime(8873): Caused by: java.lang.ClassNotFoundException: Didn't find class "de.foodev.myApp.MainActivity" on path: /data/app/de.foodev.myApp-2.apk
05-21 16:51:58.081: E/AndroidRuntime(8873):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
05-21 16:51:58.081: E/AndroidRuntime(8873):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
05-21 16:51:58.081: E/AndroidRuntime(8873):     ... 11 more

here is the beginning of the app:

public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
                ...

any hints what the error could be?

gurehbgui
  • 14,236
  • 32
  • 106
  • 178
  • ClassLoader can't find `MainActivity` class from your apk file. Is the activity correctly named in manifest.xml ? – S.D. May 21 '13 at 14:58
  • 1
    If you've recently updated to ADT 22, you can try [**this**](http://stackoverflow.com/questions/16610190/classnotfoundexception-after-adt-update/16610247#16610247) or [**this**](http://stackoverflow.com/questions/16608524/eclipse-giving-error-missing-r-java-file-after-recent-update/16608570#16608570). It's a common issue in the recent update. – Krauxe May 21 '13 at 14:58
  • Please verify the package/class name for the activity Vs. what is given in the manifest. – Gaurav Arora May 21 '13 at 14:59
  • maybe u refactored the package name after creating the project – droidchef May 21 '13 at 14:59
  • Krauxe, post this as a answer it resvoled the problem. – gurehbgui May 21 '13 at 16:38

1 Answers1

1

As Krauxe wrote, it is an error because of the update to ADT 22.

I solved it with this solution: Project -> Properties -> Java Build Path -> Order & Export and ensure Android Private Libraries are checked for your project and for all other library projects you are using. Posted here

Community
  • 1
  • 1
gurehbgui
  • 14,236
  • 32
  • 106
  • 178