Please solve this error.its an flutter project.

Error

I/CameraManagerGlobal( 8807): Connecting to camera service
E/libc    ( 8807): Access denied finding property "vendor.camera.aux.packagelist"
I/chatty  ( 8807): uid=10409(com.example.gallary2) identical 1 line
E/libc    ( 8807): Access denied finding property "vendor.camera.aux.packagelist"
W/CameraManagerGlobal( 8807): [soar.cts] ignore the status update of camera: 2
E/libc    ( 8807): Access denied finding property "vendor.camera.aux.packagelist"
W/CameraManagerGlobal( 8807): [soar.cts] ignore the status update of camera: 3
2
E/libc    ( 8807): Access denied finding property "vendor.camera.aux.packagelist"

main.dart

import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:gallary2/ui/splashpage.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  List<CameraDescription> cameras = await availableCameras();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: SplashPage(),
    );
  }
}

splashpage

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:gallary2/constants/styles.dart';
import 'package:gallary2/pages/homepage.dart';

class SplashPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    Future.delayed(Duration(seconds: 5)).then((value) {
      Navigator.pushAndRemoveUntil(
          context, MaterialPageRoute(builder: (context) => MyHomePage()),(context)=>false);
    });
    return Scaffold(
      body: Container(
        child: Center(
            child: Text(
          "Gallery",
          style: appNameSType(),
        )),
      ),
      backgroundColor: Colors.blue,
    );
  }
}

homepage

import 'dart:ffi';

import 'package:flutter/material.dart';
import 'package:gallary2/constants/styles.dart';
import 'package:gallary2/pages/camera.dart';
import 'package:gallary2/pages/offline.dart';
import 'package:gallary2/pages/online.dart';
import 'package:image_picker/image_picker.dart';

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

PickedFile _image;
final picker = ImagePicker();

getImage() async {
  var pickedFile = await picker.getImage(source: ImageSource.gallery);

  setState(() {
    pickedFile = _image;
  });
}

void setState(Null Function() param0) {}

getCamera() async {
  var pickedFile = await picker.getImage(source: ImageSource.camera);

  setState(() {
    pickedFile = _image;
  });
}

class _MyHomePageState extends State<MyHomePage> {
  Future<Void> _showChoiceDialog(BuildContext context) {
    return showDialog(
        context: context,
        builder: (BuildContext context) {
          return AlertDialog(
              title: Text("Make Your Choice"),
              content: SingleChildScrollView(
                child: ListBody(
                  children: [
                    GestureDetector(
                      child: Text("Gallary2"),
                      onTap: () {
                        getImage();
                      },
                    ),
                    Padding(padding: EdgeInsets.all(8.0)),
                    GestureDetector(
                      child: Text("Camera"),
                      onTap: () {
                        getCamera();
                      },
                    )
                  ],
                ),
              ));
        });
  }

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: [
                Tab(text: "online"),
                Tab(text: "offline"),
                Tab(
                  icon: Icon(Icons.camera_alt),
                ),
              ],
            ),
            title: Text("Gallary2", style: appNameSType()),
          ),
          body: TabBarView(
            children: [
              OfflinePage(),
              OnlinePage(),
              OnlinePage(),
              // Camera(),
            ],
          )),
    );
  }
}

............................................................................................................................................................................................................................................................................................................................................................................................................................................................................


Solution 1: Omatt

You're getting permission errors from accessing the camera. You can use the permission_handler plugin to request camera permissions.

// Request camera permission and check if granted
if (await Permission.camera.request().isGranted) {
  // Either the permission was already granted before or the user just granted it.
}