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:
Generally, when you install android studio it will install the latest SDK and latest build tool version which is not compatible with the existing projects.
You should try installing the SDK version 30. And the SDK build tool version: 30.0.X. It should work.
For me, it is working with SDK version 30 and build tool version 30.0.3.
And just make sure you have java version 8 as mentioned in build.gradle.