The problem: I'm currently using Android Studio and Gradle to compile code from a github repository (00-Evan/shattered-pixel-dungeon) and while I can run some tasks (tried 'desktop:release', 'desktop:debug'), gradle refuses to sync properly and every time I try to do it, an error log pops up:
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)
Important: I've had this issue before (while compiling previous version of this code) and back then downloading a specific version of SDK build tools (30.0.0 and 26.0.0 if I recall correctly) helped, however this doesn't help anymore.
Other people using this code don't report the same issue and I seem to be the only one.
Also for some reason android tasks also don't seem to work, as if the android studio didn't recognize them:
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.
What I've tried:
- Clearing cache and restarting Android Studio/my PC
- Enabling/disabling different build tools versions (see the "Important" section). At the moment I have tried enabling all 30.0.X and 26.0.X versions and disabling any newer versions that were enabled
- Browsed similar Stackoverflow threads, however they either didn't seem to apply to my situation or didn't include enough information. Link, link and link.
- Uninstalling Android Studio and re-downloading it from scratch.
Additional info:
- Android Studio version: Android Studio Arctic Fox | 2020.3.1 Patch 4 (Currently latest)
- Gradle version: 7.2 (I tried using 7.1.1, but that didn't solve the issue)