一、异常:error: resource android:attr/font报错VariationSettings not
原因:开始Google都是让添加代码到什么platform/android下的gradle文件中,找来找去就是找不到这个目录,就更找不到之下的gradle文件了。
解决:在app的build.gradle中添加
configurations.all { resolutionStrategy { force 'com.android.support:support-v4:27.1.0' } }
温馨提示:这个v4包的版本你可以直接修改,但是不能是28,我在报错的时候看了下默认设置的就是28,结果GG了,改成24或者27都是OK的。
二、ZXingScannerView 的使用
佳姝1:添加依赖
implementation 'me.dm7.barcodescanner:zxing:1.9.13
佳姝2:添加相机权限
<uses-permission android:name="android.permission.CAMERA" />
佳姝3:activity_zxcsan_view.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <com.dintech.esl.terminal.view.widget.NavigationView android:id="@+id/naviTitle" android:layout_width="match_parent" android:layout_height="48dp" /> &