关于barcode_scan和barcode_scan_fix

发布于 3 年前 作者 phonegap100 1408 次浏览 最后一次编辑是 3 年前 来自 分享

教程中讲的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)

如下:

aaa.png

解决方法: 请修改android/app/build.gradle 里面的 minSdkVersion 21

6.png

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

请参考:http://bbs.itying.com/topic/5d0468735923fe0334c35ea2

回到顶部