关于barcode_scan和barcode_scan_fix
教程中讲的barcode_scan的包名在2021年以后改为了barcode_scan_fix
barcode_scan_fix的用法和教程中讲的barcode_scan是一样,请按照教程中的方法配置。
安装依赖的时候注意使用barcode_scan_fix 其他的用法和教程中讲的一模一样
barcode_scan_fix : https://pub.dev/packages/barcode_scan_fix/
安装依赖的时候注意使用barcode_scan_fix
barcode_scan_fix: ^1.0.2
引入的时候使用:
import 'package:barcode_scan_fix/barcode_scan.dart';
1、使用barcode_scan_fix的时候如果提示以下错误的解决方法:
配置完成barcode_scan_fix后不要急着写代码,先用android studio打开项目,然后点击 FIle->sync project with gradle files 让android studio下载包后再去运行项目。如果运行项目提示以下错误,请配置minSdkVersion的版本
Cannot fit requested classes in a single dex file (# methods: 67048 > 65536)
如下:
解决方法: 请修改android/app/build.gradle 里面的 minSdkVersion 21
2、 注意:如果提示下面错误
Android dependency ‘androidx.core:core’ has different version for the compile (1.0.0) and runtime (1.0.2) classpath. You should manually set the same version via DependencyResolution