所以我創建和使用相機API的應用程序。該應用即將完成,只需添加更多功能即可。但是,當我嘗試從eclipse啓動模擬器或手機上的應用程序時,它會創建一個運行時錯誤,指出無法恢復活動:無法連接到相機服務。我已經嘗試了多個模擬器,並且是開啓了相機選項。我只是很困惑,爲什麼它運行完美時,作爲apk導出,並安裝在我的手機上,但當我嘗試調試它或在模擬器的形式蝕刻時不工作。有任何想法嗎?因爲現在不可能爲我錯誤追蹤。我看了很多關於無法連接到相機服務的帖子,但沒有運氣應用到我的情況。未能連接到相機錯誤,但工程時,我出口到apk
便箋:此外,相機用於罰款和幾天前運行這個確切的應用程序沒有麻煩。我的想法是它與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
你包的名字包括'frontcam'這表明你需要一個前置攝像頭......愚蠢的問題 - 你說模擬器具有相機選項打開的,但確實是包括「前」相機? – Squonk
是它確實也是這樣想直接從日食到手機推出來的時候,我用電話。它的銀河S3 –
我卸載Eclipse和重新安裝了它,同樣的錯誤仍然出現 –