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

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

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>
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值