【问题标题】:Too many methods error方法错误太多
【发布时间】:2016-01-23 18:45:11
【问题描述】:

显然,当我尝试读取和写入 xlsx 文件时,我有太多的 apache poi jar 会返回太多方法并超出限制。以下是我得到的错误

trouble writing output: Too many methods: 66024; max is 65536. By package:
    13 java.lang
     1 java.lang.reflect
     5 java.util
     1 javax.xml.namespace
    66 org.apache.xmlbeans
    19 org.apache.xmlbeans.impl.values
     1 org.apache.xmlbeans.impl.xb.xmlschema
  2500 org.openxmlformats.schemas.drawingml.x2006.chart
  1430 org.openxmlformats.schemas.drawingml.x2006.chart.impl
  8767 org.openxmlformats.schemas.drawingml.x2006.main
  5258 org.openxmlformats.schemas.drawingml.x2006.main.impl
    86 org.openxmlformats.schemas.drawingml.x2006.picture
    33 org.openxmlformats.schemas.drawingml.x2006.picture.impl

有没有办法解决这个问题?我不想删除任何库,但我的项目没有编译。请帮忙。

【问题讨论】:

    标签: android excel apache-poi dalvik


    【解决方案1】:

    找到问题了!

    这是 Apache POI 的 XSSF 与 Android 不兼容!实际上 Apache 还不错,但是当 Android 将您的 Java 代码转换为 Dalvik 可执行文件时,它的方法限制为 65536,Apache POI 的库在处理 XSSF 时超过了该限制。因此错误。它与线条无关。 :) 我只有 75 行和 7 列。有关这方面的更多信息,请访问http://mail-archives.apache.org/mod_mbox/poi-dev/201110.mbox/%3CCA+JOeWNWinmNmEtHs5VK+KEc_6BzAG_=LfpdXqsDsnjJKR2X7Q@mail.gmail.com%3E

    【讨论】:

      【解决方案2】:

      简短回答:

      只需删除不必要的 jar 文件。例如从您提供的列表中,我看到 org.openxmlformats.schemas.drawingml.x2006.main 有 '8767' 方法,如果没有必要,只需删除此 jar 文件,您的生活会更轻松。

      详细回答:

      在钛官方 Jira 上,这个 bug 仍然“重新打开”,创建于 1 年前。我认为他们明天不会发布新版本。 (https://jira.appcelerator.org/browse/TIMOB-18082)

      删除不必要的 jar 文件会导致运行时错误,但是,由于它们是不必要的,没有它们就不会发生运行时错误。

      阅读 cmets,也可以参考这里:ADT: fail to build when there are too many packages and classes

      这里:Can we create multi dex support builds in Titanium android?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-02-03
        • 2023-04-04
        • 2017-12-05
        • 2023-03-17
        • 1970-01-01
        • 2010-12-31
        • 1970-01-01
        相关资源
        最近更新 更多