RuntimeException: Fail to connect to camera service


I’m getting a java.lang.RuntimeException when trying to run the camera for the first time. (I have coded everything up to Listing 19.12)
The source of the problem in my code points me to the onResume() method of, but as far as I can tell it is exactly the same as the listing (19.5).

Any thoughts?

My code:

@TargetApi(9) @Override public void onResume() { super.onResume(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { mCamera =; // This is the line the error occurs } else { mCamera =; } }


Solved the error!

In my manifest what I had written for the permission name was “android.permissionS.CAMERA” and errantly made permission plural.