VeryGoodOpenSource / very_good_cli

A Very Good Command-Line Interface for Dart created by Very Good Ventures 🦄
http://cli.vgv.dev
MIT License
2.17k stars 190 forks source link

fix: BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65 #1163

Open neiljaywarner opened 3 days ago

neiljaywarner commented 3 days ago

Description

Android did not "just work" out of the box with zero changes on my 4 day old mac with as minimal of a setup as possible, but flutter create did. (I'm on flutter stable channel Flutter 3.24.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision 2663184aa7 (4 weeks ago) • 2024-09-11 16:27:48 -0500 )

Steps To Reproduce

  1. very_good create flutter_app testapp --desc "test app" --org "com.example" --application-id "com.example.testapp"
  2. File open

Expected Behavior

app launches on android and displays counter app on Android as it does on iOS

Additional Context

Mac m3 pro nov 2023, was purchased 4 days ago and just setup with flutter stable, android studio stable (ladybug just downloaded in the last few days) as minimal configuration as possible.

flutter run --flavor development --target lib/main_development.dart Connected devices: Pixel 6 (mobile) • 24061FDF6003TX • android-arm64 • Android 15 (API 35) iPhone 16 (mobile) • 9DE9E8A1-59FF-4B10-87EC-3969DD66DE54 • ios • com.apple.CoreSimulator.SimRuntime.iOS-18-0 (simulator) macOS (desktop) • macos • darwin-arm64 • macOS 14.6 23G80 darwin-arm64 Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.6 23G80 darwin-arm64 Chrome (web) • chrome • web-javascript • Google Chrome 129.0.6668.100

No wireless devices were found.

[1]: Pixel 6 (24061FDF6003TX) [2]: iPhone 16 (9DE9E8A1-59FF-4B10-87EC-3969DD66DE54)

[4]: Mac Designed for iPad (mac-designed-for-ipad)

Please choose one (or "q" to quit): 1 Launching lib/main_development.dart on Pixel 6 in debug mode...

FAILURE: Build failed with an exception.

BUILD FAILED in 788ms Running Gradle task 'assembleDevelopmentDebug'... 1,287ms

┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ [!] Your project's Gradle version is incompatible with the Java version that Flutter is using for Gradle. │ │ │ │ If you recently upgraded Android Studio, consult the migration guide at https://flutter.dev/to/to/java-gradle-incompatibility. │ │ │ │ Otherwise, to fix this issue, first, check the Java version used by Flutter by running flutter doctor --verbose. │ │ │ │ Then, update the Gradle version specified in /Users/neil/code/redacted_dir/android/gradle/wrapper/gradle-wrapper.properties to be │ │ compatible with that Java version. See the link below for more information on compatible Java/Gradle versions: │ │ https://docs.gradle.org/current/userguide/compatibility.html#java │ │ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Error: Gradle task assembleDevelopmentDebug failed with exit code 1 neil@Neils-MacBook-Pro downstream %

here is relevant part of flutter doctor --verbose output ` neil@Neils-MacBook-Pro downstream % flutter doctor --verbose [✓] Flutter (Channel stable, 3.24.3, on macOS 14.6 23G80 darwin-arm64, locale en-US) • Flutter version 3.24.3 on channel stable at /Users/neil/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2663184aa7 (4 weeks ago), 2024-09-11 16:27:48 -0500 • Engine revision 36335019a8 • Dart version 3.5.3 • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/neil/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11) • All Android licenses accepted.

`

Jbwzx commented 1 day ago

To fix immediate issue:

  1. Bump gradle wrapper version in android/gradle/wrapper/gradle-wrapper.properties ->
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
  1. Bump android app and kotlin android plugin versions in android/settings.gradle
id "com.android.application" version "8.1.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
  1. Update compileOptions and kotlinOptions in android/app/build.gradle
compileOptions {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = JavaVersion.VERSION_1_8
}