Access denied for property "vendor.camera.aux.packagelist"

Firstly, to check if it is a permission problem, go to the application manager of your phone, find your programme's name, and check the permission list. See if it is allowed to use the camera.

Secondly, open the XML of the layout where your "SurfaceView" resides, check if the "SurfaceView" node has the property "android:background". You must remove it if it is there. No idea why this is never mentioned.

<SurfaceView
        android:layout_width="0dp"
        android:layout_height="300dp" android:id="@+id/cameraPreview"
        app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent" android:background="#3F51B5"/>

Pay attention to the "android:background" in the above snippet. Remove it if you see it.

Thirdly, make sure you start the camera in the "surfaceCreated" event handler rather than anywhere else. You can't directly start the camera in "onViewCreated"!

Sample code just in case:

public void onViewCreated(@NonNull final View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    final CameraSource cameraSource = new CameraSource.Builder(getContext(), barcodeDetector)
            .setRequestedPreviewSize(640, 480)
            .setRequestedFps(10)
            .setAutoFocusEnabled(true).build();

    ((SurfaceView) view.findViewById(R.id.cameraPreview)).getHolder().addCallback(new SurfaceHolder.Callback() {
        @Override
        public void surfaceCreated(SurfaceHolder holder) {
            if(ContextCompat.checkSelfPermission(getContext(), Manifest.permission.CAMERA)
                    != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.CAMERA}, 1);
            }

            try {
                cameraSource.start(holder);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {}

        @Override
        public void surfaceDestroyed(SurfaceHolder holder) {
            cameraSource.stop();
        }
    });
}

I had this in my android manifest that prevented the app from using the camera.

android:hardwareAccelerated="false"

Removing it helped me.


First, check your Android version. If it is running on Android 6.0 and higher (API level 23+), then you need to :

Declare a permission in the app manifest. Make sure to insert the permission above the application tag.

<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />

<application ...>
    ...
</application>

Then, request that the user approve each permission at runtime

if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) != 
PackageManager.PERMISSION_GRANTED) { 
ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.CAMERA}, 
50); }