简体   繁体   English

flutter 条码扫描器 android 问题

[英]flutter barcode scanner android issue

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.我是 flutter 的新手,我为 ios 和 android 创建了一个条形码阅读器应用程序。我使用 flutter_barcode_scanner 插件:2.0.0 或任何,而在 ios 我打开相机时没有问题,通过权限后 android正确管理它们后,我得到一个黑屏。 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?我使用全新的 flutter sdk 2.11,但我不明白为什么它不能在 android 中工作,尽管我看过很多教程并一步一步地进行,但有人知道这可能取决于什么吗?

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; W/m.falco.lettur(18788): 访问隐藏方法 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): 访问隐藏字段 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): 访问隐藏字段 Landroid/graphics/Insets;->right:I (light greylist, linking)

W/m.falco.lettur(18788): Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking) W/m.falco.lettur(18788): 访问隐藏字段 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.问题是这样的:如果我从 mainPageNavigator 打开相机一切正常,而从其他页面打开我有黑屏,仅在 android 中。

Can you show the permission that you are passing in androidmanifest.xml你能显示你在 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" />

Access Camera Permission访问相机权限

path: android/app/AndroidManifest.xml路径: android/app/AndroidManifest.xml

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

Can you add this in your android/app/src/main/AndroidManifest.xml before < application>?你能在你的android/app/src/main/AndroidManifest.xml <application>之前添加这个吗?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM