Android应用程序强制关闭,不显示任何错误

当我在模拟器和手机上遇到强制关闭错误时,我正在使用Eclipse作为IDE编写一个Android应用程序。 我只是更改了布局和strings.xml ,我没有在eclipse中显示错误,当我尝试在eclipse仿真器或智能手机上打开应用程序时,它仍然显示“强制关闭”。 这是我的布局,main.xml。

   

我希望你能帮助我。

编辑:这里是logcat(只是复制了错误):

 10-29 13:10:20.245: E/Zygote(32): setreuid() failed. errno: 2 10-29 13:10:29.735: E/Zygote(32): setreuid() failed. errno: 17 10-29 13:10:31.146: E/BatteryService(58): usbOnlinePath not found 10-29 13:10:31.146: E/BatteryService(58): batteryVoltagePath not found 10-29 13:10:31.146: E/BatteryService(58): batteryTemperaturePath not found 10-29 13:10:31.175: E/SurfaceFlinger(58): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake 10-29 13:10:37.396: E/EventHub(58): could not get driver version for /dev/input/mouse0, Not a typewriter 10-29 13:10:37.396: E/EventHub(58): could not get driver version for /dev/input/mice, Not a typewriter 10-29 13:10:38.207: E/System(58): Failure starting core service 10-29 13:10:38.207: E/System(58): java.lang.SecurityException 10-29 13:10:38.207: E/System(58): at android.os.BinderProxy.transact(Native Method) 10-29 13:10:38.207: E/System(58): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146) 10-29 13:10:38.207: E/System(58): at android.os.ServiceManager.addService(ServiceManager.java:72) 10-29 13:10:38.207: E/System(58): at com.android.server.ServerThread.run(SystemServer.java:184) 10-29 13:10:39.256: E/SoundPool(58): error loading /system/media/audio/ui/Effect_Tick.ogg 10-29 13:10:39.266: E/SoundPool(58): error loading /system/media/audio/ui/KeypressStandard.ogg 10-29 13:10:39.266: E/SoundPool(58): error loading /system/media/audio/ui/KeypressSpacebar.ogg 10-29 13:10:39.276: E/SoundPool(58): error loading /system/media/audio/ui/KeypressDelete.ogg 10-29 13:10:39.286: E/SoundPool(58): error loading /system/media/audio/ui/KeypressReturn.ogg 10-29 13:10:41.646: E/ThrottleService(58): Could not open GPS configuration file /etc/gps.conf 10-29 13:10:42.796: E/logwrapper(143): executing /system/bin/tc failed: No such file or directory 10-29 13:10:42.936: E/logwrapper(145): executing /system/bin/tc failed: No such file or directory 10-29 13:10:42.956: E/logwrapper(147): executing /system/bin/tc failed: No such file or directory 10-29 13:10:52.650: E/HierarchicalStateMachine(58): TetherMaster - unhandledMessage: msg.what=3 10-29 13:11:10.122: E/AndroidRuntime(275): FATAL EXCEPTION: main 10-29 13:11:10.122: E/AndroidRuntime(275): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{android.androcrane.htlottakring/android.androcrane.htlottakring.Androcrane}: java.lang.ClassNotFoundException: android.androcrane.htlottakring.Androcrane in loader dalvik.system.PathClassLoader[/data/app/android.androcrane.htlottakring-2.apk] 10-29 13:11:10.122: E/AndroidRuntime(275): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585) 10-29 13:11:10.122: E/AndroidRuntime(275): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 10-29 13:11:10.122: E/AndroidRuntime(275): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 10-29 13:11:10.122: E/AndroidRuntime(275): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 10-29 13:11:10.122: E/AndroidRuntime(275): at android.os.Handler.dispatchMessage(Handler.java:99) 10-29 13:11:10.122: E/AndroidRuntime(275): at android.os.Looper.loop(Looper.java:123) 10-29 13:11:10.122: E/AndroidRuntime(275): at android.app.ActivityThread.main(ActivityThread.java:4627) 10-29 13:11:10.122: E/AndroidRuntime(275): at java.lang.reflect.Method.invokeNative(Native Method) 10-29 13:11:10.122: E/AndroidRuntime(275): at java.lang.reflect.Method.invoke(Method.java:521) 10-29 13:11:10.122: E/AndroidRuntime(275): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 10-29 13:11:10.122: E/AndroidRuntime(275): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 10-29 13:11:10.122: E/AndroidRuntime(275): at dalvik.system.NativeStart.main(Native Method) 10-29 13:11:10.122: E/AndroidRuntime(275): Caused by: java.lang.ClassNotFoundException: android.androcrane.htlottakring.Androcrane in loader dalvik.system.PathClassLoader[/data/app/android.androcrane.htlottakring-2.apk] 10-29 13:11:10.122: E/AndroidRuntime(275): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 10-29 13:11:10.122: E/AndroidRuntime(275): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 10-29 13:11:10.122: E/AndroidRuntime(275): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 10-29 13:11:10.122: E/AndroidRuntime(275): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 10-29 13:11:10.122: E/AndroidRuntime(275): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577) 10-29 13:11:10.122: E/AndroidRuntime(275): ... 11 more : E/(): Device disconnected 

这似乎已经发生,因为相应位置缺少类

这是你的日志摘录

  at dalvik.system.NativeStart.main(Native Method) 10-29 13:11:10.122: E/AndroidRuntime(275): Caused by: java.lang.ClassNotFoundException: android.androcrane.htlottakring.Androcrane in loader dalvik.system.PathClassLoader[/data/app/android.androcrane.htlottakring-2.apk] 10-29 13:11:10.122: E/AndroidRuntime(275): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 10-29 13:11:10.122: E/AndroidRuntime(275): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 10-29 13:11:10.122: E/AndroidRuntime(275): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 10-29 13:11:10.122: E/AndroidRuntime(275): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 10-29 13:11:10.122: E/AndroidRuntime(275): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577) 10-29 13:11:10.122: E/AndroidRuntime(275): ... 11 more 

所以要确保这个class级位于那里。为了避免这种情况

它可能是您的相对布局的错误,有时xml中元素的顺序很重要,可能导致崩溃。 擦除布局并使用设计模式重新创建所有组件。