【发布时间】:2021-12-13 20:17:25
【问题描述】:
问题:我目前正在使用 Android Studio 和 Gradle 从 github 存储库 (00-Evan/shattered-pixel-dungeon) 编译代码,而我可以运行一些任务(尝试过'desktop:release'、'desktop:debug'),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、link 和 link。
- 卸载 Android Studio 并从头开始重新下载。
其他信息:
- Android Studio 版本:Android Studio 北极狐 | 2020.3.1 补丁 4(当前最新)
- Gradle 版本:7.2(我尝试使用 7.1.1,但没有解决问题)
【问题讨论】:
标签: java android android-studio gradle