flutter / flutter/samples

Many samples use old Gradle, impossible to build on modern JDK

Open
#2,568 0 comments 2 reactions 1 assignee Claimed by @ericwindmill View on GitHub
bug
Dominant language
Dart
Stars
19.3k
Forks
7.9k
Avg merge
3h 26m
Merged PRs (30d)
3

Description

E.g. running `flutter build apk --debug` in `add_to_app/books/flutter_module_books` results in:

```
FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file '/Users/bartek/projects/flutter-samples/add_to_app/books/flutter_module_books/.android/settings.gradle' (/Users/bartek/.cache/gradle/caches/8.0/scripts/4pgstqpbdapknfa7p7f6rr9s5).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 67

* Try:
> 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
```

I'm using the latest stable JDK:

```
$ java --version
openjdk 23.0.2 2025-01-21
OpenJDK Runtime Environment Homebrew (build 23.0.2)
OpenJDK 64-Bit Server VM Homebrew (build 23.0.2, mixed mode, sharing)
```

Action item 1: update all samples to Gradle 8.12 (latest as of now)

Action item 2: maybe think of some automation to update those versions automatically?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.