Home > Enterprise >  flutter barcode scanner android
flutter barcode scanner android

Time:03-03

I am new to flutter, I have created a barcode reader app for ios and android. I use the flutter_barcode_scanner plugin: 2.0.0 or any, while on ios I have no problem when I open the camera, with android after passing the permissions and having managed them correctly I get a black screen. I use the brand new flutter sdk 2.11 and I don't understand why it can't work in android, although I have seen many tutorials and followed step by step, does anyone have any idea what this might depend on?

This is the log when i try to open camera

W/m.falco.lettur(18788): Accessing hidden method Landroid/graphics/drawable/Drawable;->getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking)

W/m.falco.lettur(18788): Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking

W/m.falco.lettur(18788): Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking)

W/m.falco.lettur(18788): Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking)

the problem is this: if i open camera from mainPageNavigator all is ok,while instead open from the other page i have black screen,only in android.

CodePudding user response:

Can you show the permission that you are passing in androidmanifest.xml

you need to pass these permissions

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.FLASHLIGHT" />

CodePudding user response:

Access Camera Permission

path: android/app/AndroidManifest.xml

  <uses-permission android:name="android.permission.CAMERA"/>
    <application 

CodePudding user response:

Can you add this in your android/app/src/main/AndroidManifest.xml before < application> ?

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

  • Related