使用模拟器无法连接到相机服务?

时间:2012-06-08 09:01:52

标签: android android-emulator

今天我想测试我几天前开发的应用程序,而且服务器服务是其中的一部分。 今天,我想在EMULATOR上测试该应用程序,但我发现logcat说:

Fail to connect to the camera service

despit of,我之前使用过EMULATOR测试了相同的应用程序,并且它工作正常,但今天我收到了这个错误。

清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidbook.SaveImgPathSQLite"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".SaveImg"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

logcat的:

    06-08 05:28:46.539: E/AndroidRuntime(765): FATAL EXCEPTION: main
06-08 05:28:46.539: E/AndroidRuntime(765): java.lang.RuntimeException: Fail to connect to camera service
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.hardware.Camera.native_setup(Native Method)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.hardware.Camera.<init>(Camera.java:258)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.hardware.Camera.open(Camera.java:235)
06-08 05:28:46.539: E/AndroidRuntime(765):  at amr.NAVKA_Projekt.MPTest.CameraSurface.surfaceCreated(CameraSurface.java:44)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.view.SurfaceView.updateWindow(SurfaceView.java:543)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.view.SurfaceView.dispatchDraw(SurfaceView.java:348)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.view.View.draw(View.java:6883)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.widget.FrameLayout.draw(FrameLayout.java:357)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.view.View.draw(View.java:6883)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.widget.FrameLayout.draw(FrameLayout.java:357)
06-08 05:28:46.539: E/AndroidRuntime(765):  at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1862)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.view.ViewRoot.draw(ViewRoot.java:1522)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.view.ViewRoot.performTraversals(ViewRoot.java:1258)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.os.Looper.loop(Looper.java:130)
06-08 05:28:46.539: E/AndroidRuntime(765):  at android.app.ActivityThread.main(ActivityThread.java:3683)
06-08 05:28:46.539: E/AndroidRuntime(765):  at java.lang.reflect.Method.invokeNative(Native Method)
06-08 05:28:46.539: E/AndroidRuntime(765):  at java.lang.reflect.Method.invoke(Method.java:507)
06-08 05:28:46.539: E/AndroidRuntime(765):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-08 05:28:46.539: E/AndroidRuntime(765):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-08 05:28:46.539: E/AndroidRuntime(765):  at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:0)

您可以使用使用相机服务的应用程序

如果你真的想在模拟器上使用它follow this instruction