我在Eclipse for Eclipse中有一个现有的项目,它们仍然没有问题。
自从我使用Android以来,已经有一段时间了,我从零开始创建了一个新版本。但是,它在测试手机(三星s3)时崩溃了,我无法弄清楚原因。所有设置看起来与我的其他仍然有效的项目相同。我收到Source Not Found错误。在没有运气的情况下尝试了许多建议。
也许是因为我做了最低限度的事情,我做得还不够。项目树,清单,java类和xml如下:
错误:
在崩溃时记录Cat文本:
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
答案 0 :(得分:2)
我猜你得到了Activity not found error
因为忘了在.
manifest.xml
添加到您的活动中
<activity
android:name=".McsHome"
........../>
我不确定试试这个..
答案 1 :(得分:-1)
你可以在我的第一个截图中看到我有&#34; mcsapp&#34;包名称&#34; src&#34;。当看到logcat错误时,它说它无法在&#34; com.mcsapp&#34;下找到所说的类,所以我创建了一个名为&#34; com.mcsapp&#34;的新包。并把我的班级搬进去了。
问题解决了。
感谢大家的帮助