解决二维码Both dimensions must be greater than 0

xiaoxiao2025-07-19  5

处理二维码扫描遇到报错:

java.lang.IllegalArgumentException: Both dimensions must be greater than 0         at com.google.zxing.common.BitMatrix.<init>(BitMatrix.java:50)         at com.google.zxing.common.GlobalHistogramBinarizer.getBlackMatrix(GlobalHistogramBinarizer.java:91)         at com.google.zxing.common.HybridBinarizer.getBlackMatrix(HybridBinarizer.java:86)         at com.google.zxing.BinaryBitmap.getBlackMatrix(BinaryBitmap.java:85)         at com.google.zxing.qrcode.QRCodeReader.decode(QRCodeReader.java:77)         at com.google.zxing.MultiFormatReader.decodeInternal(MultiFormatReader.java:171)         at com.google.zxing.MultiFormatReader.decodeWithState(MultiFormatReader.java:85)         at com.uuzuche.lib_zxing.decoding.DecodeHandler.decode(DecodeHandler.java:86)         at com.uuzuche.lib_zxing.decoding.DecodeHandler.handleMessage(DecodeHandler.java:55)         at android.os.Handler.dispatchMessage(Handler.java:111)         at android.os.Looper.loop(Looper.java:194)         at com.uuzuche.lib_zxing.decoding.DecodeThread.run(DecodeThread.java:83)

 

解决方案:

you have use yipianfengye/android-zxingLibrary there is a method "initDisplayOpinion()" in his ZApplication what you need to do is adding "extends ZApplication" in your own Application

即在manifest清单文件中修改:

<application         android:name="com.uuzuche.lib_zxing.MyApplication"

        ……        >

</application>
转载请注明原文地址: https://www.6miu.com/read-5033348.html

最新回复(0)