生成二维码那步,为什么我的没有显示出捕捉异常?而是The method encode(String, BarcodeFormat, int, int) from the type MultiFormatWriter refers to the missing type BarcodeFormat,怎么解决?
这个问题是 jar包没处理好造成的编译报错信息
导入zxing的源码,源码有一些编译错误信息要处理好,然后再导出jar包, 这个jar包才算是可以使用的。
都没人解答错误?
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
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();
}