我正在使用安卓应用程序中的iText来创建pdf。
try{
File file=new File("test.pdf");
FileOutputStream fileout=new FileOutputStream(file);
Document document=new Document();
} catch (FileNotFoundException e) {
e.printStackTrace();
}这会产生一个错误(文档抽象类-无法实例化)。
即使在导入import com.itextpdf.text.Document;之后
它显示了这个东西:
Cannot resolve symbol 'itextpdf'文档显示为错误。
有什么解决方案吗?
发布于 2018-10-16 23:55:23
首先必须在gradle属性中添加"compile 'com.itextpdf:itextg:5.5.10'“。
第二,你可以尝试:
顺便说一句,您在Project Structure对话框中看到的错误消息在大多数情况下都不是实际问题。
发布于 2018-10-17 11:44:42
对于第一个错误,尝试使用
try{
File file=new File("test.pdf");
FileOutputStream fileout=new FileOutputStream(file);
com.itextpdf.text.Document document=new com.itextpdf.text.Document();
} catch (FileNotFoundException e) {
e.printStackTrace();
}第二
Cannot resolve symbol 'itextpdf'Android Studio says "cannot resolve symbol" but project compiles
https://stackoverflow.com/questions/52839391
复制相似问题