为了账号安全,请及时绑定邮箱和手机立即绑定

生成二维码的问题

生成二维码那步,为什么我的没有显示出捕捉异常?而是The method encode(String, BarcodeFormat, int, int) from the type MultiFormatWriter refers to the missing type BarcodeFormat,怎么解决?

正在回答

4 回答

这个问题是 jar包没处理好造成的编译报错信息

导入zxing的源码,源码有一些编译错误信息要处理好,然后再导出jar包,  这个jar包才算是可以使用的。

0 回复 有任何疑惑可以回复我~

都没人解答错误?

0 回复 有任何疑惑可以回复我~

try{
   BitMatrix bitT=new MultiFormatWriter().encode(content,BarcodeFormat.QR_CODE,width,height,hints);
   Path file=new File("D:/jaja/img.png").toPath();
   MatrixToImageWriter.writeToPath(bitT,format,file);
  }catch(Exception e){
   e.printStackTrace();
  }
 }

出现错误说The method encode(String, BarcodeFormat, int, int, Map<EncodeHintType,?>) from the type MultiFormatWriter refers to the missing type BitMatrix
 The method writeToPath(BitMatrix, String, Path) from the type MatrixToImageWriter refers to the missing type BitMatrix

啥情况0.0

 

0 回复 有任何疑惑可以回复我~
#1

名字要牛逼

LZ,你解决了吗,我也遇到了
2017-06-01 回复 有任何疑惑可以回复我~

try {

BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, width, height,hints);

Path file  = new File("E:\\img.png").toPath();

FileOutputStream out=new FileOutputStream("E:\\img.png");

MatrixToImageWriter.writeToStream(bitMatrix, format, out);

} catch (Exception e) {

e.printStackTrace();

}


0 回复 有任何疑惑可以回复我~
#1

qq_BullshitGame_0 提问者

hints.put(EncodeHintType.MARGIN, 2); 这句 显示错误说 put重名了? 前面还有2行代码 是hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); 怎么回事?
2016-09-08 回复 有任何疑惑可以回复我~
#2

qq_BullshitGame_0 提问者

写中文的时候 扫描是乱码 版本问题吗?
2016-09-08 回复 有任何疑惑可以回复我~
#3

qq_习惯就好_11 回复 qq_BullshitGame_0 提问者

点击编写的类,右键->properties->other改为utf-8试试
2016-09-09 回复 有任何疑惑可以回复我~
#4

qq_BullshitGame_0 提问者 回复 qq_习惯就好_11

!!! 注析 变乱码了.!
2016-09-10 回复 有任何疑惑可以回复我~
查看1条回复

举报

0/150
提交
取消
Java生成二维码
  • 参与学习       84388    人
  • 解答问题       203    个

二维码无处不在,自己动手用Java生成二维码,三种生成方式任你选

进入课程

生成二维码的问题

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信