Android应用程序在提取为apk时运行完美,但不会在模拟器中创建错误

时间:2013-05-28 02:58:41

标签: java android android-camera

所以我正在使用相机API创建和应用。该应用程序即将完成它只需要添加一些功能。但是,当我尝试在模拟器或我的手机上从eclipse启动应用程序时,它会创建一个运行时错误,指出无法恢复活动:无法连接到相机服务。我尝试了多个模拟器,是的,相机选项已打开。我很困惑,为什么它在导出为apk并安装在我的手机上时运行完美但在我尝试调试它或模拟器形式eclipse时不起作用。有任何想法吗?因为我现在不可能错误地跟踪。我看过很多与无法连接到相机服务相关的帖子,但没有运气应用于我的环境。

旁注:此外,相机曾经工作正常并且几天前运行了这个确切的应用程序,没有任何麻烦。我的想法是它与eclipse有关。由于从apk运行时,该应用程序在我的手机上完美运行

更新:我卸载了eclipse并重新安装了它,但仍然发生了同样的错误。怎么了?当我在eclipse ahhg

中运行它时,这段代码不起作用

我的LogCat:

05-27 22:20:55.197: E/AndroidRuntime(419): FATAL EXCEPTION: main
05-27 22:20:55.197: E/AndroidRuntime(419): java.lang.RuntimeException: Unable to resume activity {com.fuchs.frontcam/com.fuchs.frontcam.MainActivity}: java.lang.RuntimeException: Fail to connect to camera service
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2120)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2135)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1668)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.os.Looper.loop(Looper.java:123)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.app.ActivityThread.main(ActivityThread.java:3683)
05-27 22:20:55.197: E/AndroidRuntime(419):  at java.lang.reflect.Method.invokeNative(Native Method)
05-27 22:20:55.197: E/AndroidRuntime(419):  at java.lang.reflect.Method.invoke(Method.java:507)
05-27 22:20:55.197: E/AndroidRuntime(419):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-27 22:20:55.197: E/AndroidRuntime(419):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-27 22:20:55.197: E/AndroidRuntime(419):  at dalvik.system.NativeStart.main(Native Method)
05-27 22:20:55.197: E/AndroidRuntime(419): Caused by: java.lang.RuntimeException: Fail to connect to camera service
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.hardware.Camera.native_setup(Native Method)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.hardware.Camera.<init>(Camera.java:258)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.hardware.Camera.open(Camera.java:220)
05-27 22:20:55.197: E/AndroidRuntime(419):  at com.fuchs.frontcam.MainActivity.initCamera(MainActivity.java:56)
05-27 22:20:55.197: E/AndroidRuntime(419):  at com.fuchs.frontcam.MainActivity.onResume(MainActivity.java:49)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.app.Activity.performResume(Activity.java:3832)
05-27 22:20:55.197: E/AndroidRuntime(419):  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2110)
05-27 22:20:55.197: E/AndroidRuntime(419):  ... 12 more

0 个答案:

没有答案