【问题标题】:More than one file was found with OS independent path 'com/itextpdf/io/font/cmap_info.txt'找到多个文件,其独立于操作系统的路径 'com/itextpdf/io/font/cmap_info.txt'
【发布时间】:2018-07-21 12:56:42
【问题描述】:

这是我的代码:

 public  void CreateDirectory() throws FileNotFoundException {
        File pdfFolder = new File(Environment.getExternalStoragePublicDirectory(
                Environment.DIRECTORY_DOCUMENTS), "pdfdemo");
        if (!pdfFolder.exists()) {
            pdfFolder.mkdir();
        }


        //Create time stamp
        Date date = new Date() ;
        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(date);

        File myFile = new File(pdfFolder + timeStamp + ".pdf");

        OutputStream output = new FileOutputStream(myFile);

        //Initialize PDF writer
        PdfWriter writer = new PdfWriter(myFile.getPath());

        //Initialize PDF document
        PdfDocument pdf = new PdfDocument(writer);

        // Initialize document
        Document document = new Document(pdf);

        //Add paragraph to the document

    document.add(new Paragraph("Hello World!"));

    document.close();
}

在 build.gradle 中:

    dependencies {

    implementation 'com.itextpdf:itext7-core:7.0.2'

}

但是当我尝试运行程序时,它给了我这个错误:

找到多个文件,其独立于操作系统的路径为“com/itextpdf/io/font/cmap_info.txt”

我该怎么办?

【问题讨论】:

  • “它给了我那个错误” - 请也分享堆栈跟踪。

标签: android itext


【解决方案1】:

build.gradle 中的以下代码为我修复了它

packagingOptions {
        exclude 'com/itextpdf/io/font/cmap_info.txt'
        exclude 'com/itextpdf/io/font/cmap/*'
    }

【讨论】:

    【解决方案2】:

    在我的情况下,禁用 Firebase 插件工作正常

    【讨论】:

    • 我也有同样的问题,但没有 firebase 插件。
    猜你喜欢
    • 2019-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多