I'm going through this tutorial for Cameras and Android.
But I constantly get the error: java.lang.RuntimeException: Fail to connect to camera service
Here is my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DisplayMessageActivity" />
<activity android:name=".CameraActivity"
android:label="@string/app_name"
android:screenOrientation="landscape">
</activity>
</application>
</manifest>
I think the reason is that the class android.hardware.Camera
is deprecated.
Is that possible?
If the reason for this error is that the class android.hardware.Camera
is deprecated, then I need to use the class android.hardware.Camera2;
?