jzbrooks / vgo

vector graphic optimization
MIT License
43 stars 2 forks source link

Java Runtime incompatibility #35

Closed jakoss closed 3 years ago

jakoss commented 3 years ago

Describe the bug I have error

* What went wrong:
Execution failed for task ':app:shrinkVectorArtwork'.
> com/jzbrooks/vgo/Application has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

when running ':app:shrinkVectorArtwork'

I'm using build-in JDK, more info:

Android Studio 4.1.2
Build #AI-201.8743.12.41.7042882, built on December 20, 2020
Runtime version: 1.8.0_242-release-1644-b01 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 4046M
Cores: 6
Registry: ide.new.welcome.screen.force=true, editor.full.width.scrollbar=true, external.system.auto.import.disabled=true
Non-Bundled Plugins: com.codertainment.scrcpy, mobi.hsz.idea.gitignore, com.dubreuia, com.intellij.marketplace, org.jetbrains.kotlin, me.scana.okgradle, org.mapstruct.intellij, org.spekframework, com.developerphil.adbidea, com.wahdan.com.wahdan.spockAdb, Dart, io.flutter, de.mariushoefler.flutter_enhancement_suite, com.icapps.niddler

Expected behavior Successful compression of all files

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

jzbrooks commented 3 years ago

I'd recommend using a newer JDK. Java 8 is a very old runtime (released in 2014!). Android tooling has lagged in this respect for quite some time, but I've been using the most recent long term support version, JDK 11 (released in 2018), in my day job for quite some time without issue.

I chose to target JDK 11 with this tool to move forward instead of languishing in the 2014 era of the JVM bytecode spec. I'm happy to leave this issue open for a while for discussion.

jakoss commented 3 years ago

I was not aware that I can do that 😂

I know that android studio 4.2 is going jdk 11 by default, but I was sure I need newer (unstable) gradle plugin for that. Will experiment, thanks.

@jzbrooks Are you developing on windows by any chance? If yes - what JDK do you recommend?

jzbrooks commented 3 years ago

I use macOS personally with this homebrew tap, but I'm sure there are adoptopenjdk packages on chocolatey as well. You should be able to install any JDK 11, set it as your java home, and run your build (if you're using Gradle daemons, then be sure to run gradlew --stop so that Gradle starts new daemons that will pick up your new environment.

You should also be able to configure Studio to use the same JDK as well through module settings.

jakoss commented 3 years ago

I found AdoptOpenJDK on chocolatey and it's working great, thanks!

jzbrooks commented 3 years ago

No problem. I also made a note in the readme about the compatibility b3a3f012b241e30b4a5b614dc63ae2e110aeb262.