An error occurred with my app which ran in Nexus5 (Android6.0).
The error was
java.lang.RuntimeException: Fail to connect to camera service
I had added the permission to the AndroidManifest.xml.
But the app is OK with another phone(Android5.1), and genymotion AVD(Android 4.0).
The key code is below
@Override public void onResume() { super.onResume(); try { mCamera = Camera.open(); }catch (Exception e){ Log.e(TAG,"open camera failed",e); } }
Write in your gradle.build targetSdkVersion 22. It is a temporary solution but work.
open Settings -> Apps -> click you app -> Permissions -> open Camera permissions.
you can see: http://developer.android.com/training/permissions/requesting.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With