shorebird icon indicating copy to clipboard operation
shorebird copied to clipboard

fix: "Unsupported class file major version 65"

Open eseidel opened this issue 1 year ago • 3 comments

Report from a customer over email:

Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --status for details
> Task :gradle:compileGroovy FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gradle:compileGroovy'.
> BUG! exception in phase 'semantic analysis' in source unit 'C:\Users\foo\.shorebird\bin\cache\flutter\@addba5b750987523c04ebe69e97555 09369615a\packages\flutter_tools\gradle\src\main\groovy\app_plugin_loader.groovy' Unsupported class file major version 65
Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.

eseidel avatar May 05 '24 16:05 eseidel

Looks like possibly a gradle mismatch between? But I'm not quite sure where the various versions of gradle would be coming from?

eseidel avatar May 05 '24 16:05 eseidel

Ah, this looks like Java version incompatibility. https://stackoverflow.com/questions/68597899/bug-exception-in-phase-semantic-analysis-in-source-unit-buildscript-unsup

Presumably we're finding the wrong version of Java on your system (a different version that Flutter is finding).

Could you please share the results of shorebird doctor -v. e.g. mine:

shorebird doctor -v
Shorebird 1.0.5 • [email protected]:shorebirdtech/shorebird.git
Flutter 3.19.6 • revision 4b22a31bd9911c8317319292a9a103217919649e
Engine • revision ef2c5cd963e481d44741e2a587ecb7ad69629ce1

Android Toolchain
  • Android Studio: /Applications/Android Studio.app/Contents
  • Android SDK: /Users/eseidel/Library/Android/sdk
  • ADB: /Users/eseidel/Library/Android/sdk/platform-tools/adb
  • JAVA_HOME: /Applications/Android Studio.app/Contents/jbr/Contents/Home

✓ Shorebird is up-to-date (0.9s)
✓ Flutter install is correct (0.3s)
✓ AndroidManifest.xml files contain INTERNET permission (29ms)
✓ Has access to storage.googleapis.com (0.1s)
✓ shorebird.yaml found in pubspec.yaml assets (3ms)

No issues detected!

You will likely see that the java path we find is different from the one found by flutter doctor -v and that's the problem. We will likely need to fix our java path detection to more closely match Flutter's. e.g. the Android section from my flutter doctor -v:

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc1)
    • Android SDK at /Users/eseidel/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0-rc1
    • ANDROID_HOME = /Users/eseidel/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

eseidel avatar May 07 '24 15:05 eseidel

Presumably related to https://github.com/shorebirdtech/shorebird/issues/1821

eseidel avatar May 07 '24 23:05 eseidel

@eseidel your java from the shorebird doctor and flutter doctor in the previous comment is very much likely the same, it is just that we used to print only the JAVA_HOME in our shorebird doctor output, which in your comment is:

/Applications/Android Studio.app/Contents/jbr/Contents/Home

On your flutter doctor, it prints the executable, , which is

/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java

But note that those two are the same folder. There might be still some wrong logic in our java detection for linux and widnows, but seems that MacOs it is working fine!

erickzanardo avatar May 30 '24 19:05 erickzanardo

Lol, I see I was talking to myself here. I should have replied to the customer over email. I think we can close this.

eseidel avatar May 30 '24 19:05 eseidel