“无法找到方法 ''void org.apache.commons.compress.archivers.zip.ZipFile.(java.nio.channels.SeekableByteChannel)''”

2024-01-20

问题:我目前正在使用安卓工作室 and Gradle从 github 存储库编译代码(00-埃文/破碎像素地牢 https://github.com/00-Evan/shattered-pixel-dungeon/)虽然我可以运行一些任务(尝试过“桌面:发布”,“桌面:调试”),但 gradle 拒绝正确同步,每​​次我尝试执行此操作时,都会弹出错误日志:

FAILURE: Build failed with an exception.

* What went wrong:
'void org.apache.commons.compress.archivers.zip.ZipFile.<init>(java.nio.channels.SeekableByteChannel)'

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
java.lang.NoSuchMethodError: 'void org.apache.commons.compress.archivers.zip.ZipFile.<init>(java.nio.channels.SeekableByteChannel)'
    at com.android.repository.util.InstallerUtil.unzip(InstallerUtil.java:99)

重要的:我以前遇到过这个问题(在编译此代码的早期版本时),然后下载特定版本的 SDK 构建工具(如果我没记错的话,为 30.0.0 和 26.0.0)有所帮助,但这不再有帮助了。
使用此代码的其他人没有报告同样的问题,我似乎是唯一的一个。

另外,由于某种原因,android 任务似乎也无法工作,就好像 android studio 无法识别它们一样:

Task 'release' not found in project ':android'.

 * Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

我尝试过的:

  • 清除缓存并重新启动 Android Studio/我的电脑
  • 启用/禁用不同的构建工具版本(请参阅“重要”部分)。目前我已尝试启用所有 30.0.X 和 26.0.X 版本并禁用已启用的任何较新版本
  • 浏览了类似的 Stackoverflow 线程,但它们要么似乎不适用于我的情况,要么没有包含足够的信息。Link https://stackoverflow.com/questions/52381075/apache-poi-java-lang-noclassdeffounderror-org-apache-commons-compress-archivers, link https://stackoverflow.com/questions/68982459/i-try-to-build-a-project-but-it-continuely-fails-the-build-with-two-errors and link https://stackoverflow.com/questions/48343759/java-lang-nosuchmethoderror-org-apache-commons-compress-utils-ioutils-readfully.
  • 卸载 Android Studio 并从头开始重新下载。

附加信息:

  • Android Studio 版本:Android Studio 北极狐 | 2020.3.1补丁4(当前最新)
  • Gradle版本:7.2(我尝试使用7.1.1,但这没有解决问题)

对于任何寻求更多信息的人来说,这个特定问题已被涵盖在 Google 的问题跟踪器中 https://issuetracker.google.com/issues/213757977。简而言之,问题源于 Apache 的依赖解析不匹配commons-compress之间robovm-gradle-plugin以及 Gradle 本身。至于破碎像素地牢,已修复在这次提交中 https://github.com/00-Evan/shattered-pixel-dungeon/commit/1b28cd19b5f59a5a8b7b9acf4c3565b19033f378.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

“无法找到方法 ''void org.apache.commons.compress.archivers.zip.ZipFile.(java.nio.channels.SeekableByteChannel)''” 的相关文章

随机推荐