Issue
I have existing project in Eclipse for Android that all still run with no issues.
It's been a while since I have been on Android and I created a new one from scratch. However, it crashes when testing to a phone (Samsung s3) and I can't figure out why. All the settings seem just the same as my other projects that still work. I get a Source Not Found error. Tried many suggestions on here without luck.
Maybe it's a case of I haven't done enough as I have done the bare minimum. Project tree, manifest, java class and xml below:
Error:
Log Cat text around the time of crash:
10-31 19:28:10.536: I/ActivityManager(2361): Process com.mcsapp (pid 30623) (adj 0) has died.
10-31 19:28:10.536: W/ActivityManager(2361): mDVFSHelper.acquire()
10-31 19:28:10.546: E/ViewRootImpl(2361): sendUserActionEvent() mView == null
10-31 19:28:10.561: D/dalvikvm(30720): Late-enabling CheckJNI
10-31 19:28:10.586: V/WindowManager(2361): Window{42d28228 u0 Keyguard}mOrientationRequetedFromKeyguard=false
10-31 19:28:10.586: D/WindowManager(2361): computeScreenConfigurationLocked() set config.orientation=1 dw=720 dh=1280 Callers=com.android.server.wm.WindowManagerService.updateOrientationFromAppTokensLocked:5171 com.android.server.wm.WindowManagerService.updateOrientationFromAppTokens:5142 com.android.server.am.ActivityStack.realStartActivityLocked:1021
10-31 19:28:10.586: D/PowerManagerService(2361): setKeyboardVisibility: false
10-31 19:28:10.596: V/WindowManager(2361): Window{42d28228 u0 Keyguard}mOrientationRequetedFromKeyguard=false
10-31 19:28:10.621: D/AndroidRuntime(30720): Shutting down VM
10-31 19:28:10.621: W/dalvikvm(30720): threadid=1: thread exiting with uncaught exception (group=0x41c37700)
10-31 19:28:10.626: E/AndroidRuntime(30720): FATAL EXCEPTION: main
10-31 19:28:10.626: E/AndroidRuntime(30720): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mcsapp/com.mcsapp.McsHome}: java.lang.ClassNotFoundException: Didn't find class "com.mcsapp.McsHome" on path: /data/app/com.mcsapp-1.apk
10-31 19:28:10.626: E/AndroidRuntime(30720): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2219)
10-31 19:28:10.626: E/AndroidRuntime(30720): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
10-31 19:28:10.626: E/AndroidRuntime(30720): at android.app.ActivityThread.access$700(ActivityThread.java:159)
10-31 19:28:10.626: E/AndroidRuntime(30720): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
10-31 19:28:10.626: E/AndroidRuntime(30720): at android.os.Handler.dispatchMessage(Handler.java:99)
10-31 19:28:10.626: E/AndroidRuntime(30720): at android.os.Looper.loop(Looper.java:176)
10-31 19:28:10.626: E/AndroidRuntime(30720): at android.app.ActivityThread.main(ActivityThread.java:5419)
10-31 19:28:10.626: E/AndroidRuntime(30720): at java.lang.reflect.Method.invokeNative(Native Method)
10-31 19:28:10.626: E/AndroidRuntime(30720): at java.lang.reflect.Method.invoke(Method.java:525)
10-31 19:28:10.626: E/AndroidRuntime(30720): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
10-31 19:28:10.626: E/AndroidRuntime(30720): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
10-31 19:28:10.626: E/AndroidRuntime(30720): at dalvik.system.NativeStart.main(Native Method)
10-31 19:28:10.626: E/AndroidRuntime(30720): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mcsapp.McsHome" on path: /data/app/com.mcsapp-1.apk
10-31 19:28:10.626: E/AndroidRuntime(30720): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:64)
10-31 19:28:10.626: E/AndroidRuntime(30720): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
10-31 19:28:10.626: E/AndroidRuntime(30720): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
10-31 19:28:10.626: E/AndroidRuntime(30720): at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
10-31 19:28:10.626: E/AndroidRuntime(30720): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2210)
10-31 19:28:10.626: E/AndroidRuntime(30720): ... 11 more
10-31 19:28:10.626: I/ActivityManager(2361): Notify an ApplicationCrash
10-31 19:28:10.791: V/LvOutput(1934): initCheck: 0
10-31 19:28:10.791: V/LvOutput(1934): detachEffects: detach processing for output 2, stream 1, session 128
Solution
You can see in my first screenshot that I had "mcsapp" package name under "src". When looking at the logcat error it was stating it couldn't find said class under "com.mcsapp", so I created a new package named "com.mcsapp" and moved my class into it.
Problem solved.
Answered By - Dan James Palmer