看板 java 關於我們 聯絡資訊
Android SDK 模擬器版本 2.2 Android 手機: DHD 手機的 Debug mode 已開啟 程式碼: CameraAPplication.java http://nopaste.info/38efb3e676.html manifest http://nopaste.info/c51dc1428c.html main.xml http://nopaste.info/e22dcd0696.html cameraoverlay.xml http://nopaste.info/e0d54c8d49.html 問題描述: 這個程式碼是根據 The Android Developer's Cookbook Building Applications with the Android SDK 這本書第7章 Camera的內容打上去的, 經過小部份 2.2版本的修正後, 可以在 Android 2.2版模擬器上執行. 但是, 假如要在 實際手機上執行的話, 就會出現以下錯誤: FATAL EXCEPTION: main java.lang.RuntimeException: Fail to connect to camera service at android.hardware.Camera.native_setup(Native Method) at android.hardware.Camera.<init>(Camera.java:118) at android.hardware.Camera.open(Camera.java:91) at CJH.test.Ytest19.CameraAPplication.surfaceCreated(CameraAPplication.java:135) at android.view.SurfaceView.updateWindow(SurfaceView.java:540) ... http://nopaste.info/d0ba63ede1_nl.html 較完整錯誤訊息在這裡 我在manifest裡面已經加了這兩行: <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> 但還是沒辦法連到實機上的Camera, 是不是漏掉什麼沒寫的呢? 謝謝大家! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.117.143.183 ※ 編輯: ericinttu 來自: 59.117.143.183 (01/04 20:28)
lovelycateye:能的話試試看用舊一點的手機測看看,硬體雷很多 01/05 11:33