0

我做了这个问题,我看到存在一个名为 ZipInputStream 的构造函数:

ZipInputStream(BufferedInputStream, Charset)

但是调试器向我抛出了错误:

ZipInputStream(BufferedInputStream, Charset) is undefined

并给我建议:

remove the argument to match ZipInputStream(InputStream)

我已经安装了最新的JDK和 JRE 7,但我仍然有同样的错误。

最后我在这里解决了这个问题:

使用 ZipInputStream 错误 UTFDataFormatException 提取文件

4

2 回答 2

1

如果您对 Android 应用程序进行编程,则您正在使用 android 库。androidZipInputStream没有带有签名的公共构造函数ZipInputStream(InputStream, Charset)。您在 PC 上安装什么 JDK 或 JRE 并不重要,因为您的应用程序不会在 PC 上运行(或在 PC 上但在模拟器中)。

于 2014-07-02T07:30:25.827 回答
1

显然,Android API 中没有其他选择。但是,如果您可以安排 ZIP 文件设置了“语言编码标志 (EFS)”位,那么最新版本的 android 应该尊重它,并将条目名称线程化为 UTF-8 编码。

请注意,第二个ZipInputStream构造函数已添加到 Java 7 中的(实际)Java 类库中,并且 Android API 基于 Java 6。

参考:

于 2014-07-02T07:59:57.970 回答