Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"error: invalid source release: 17" and other compilation issues #2965

Closed
miquelbeltran opened this issue May 27, 2024 · 2 comments
Closed
Labels
all documentation Improvements or additions to documentation

Comments

@miquelbeltran
Copy link
Member

miquelbeltran commented May 27, 2024

If you are facing a compilation error similar to this:

* What went wrong:
Execution failed for task ':package_info_plus:compileDebugJavaWithJavac'.
> error: invalid source release: 17

1. Upgrade and clean project

  1. Upgrade Flutter: flutter upgrade
  2. Upgrade project dependencies: flutter pub upgrade
  3. Clean project: flutter clean
  4. Try again.

2. Check project requirements

You can find them in the packages README.md.

For example:

  • Flutter >=3.3.0
  • Dart >=2.18.0 <4.0.0
  • Android compileSDK 34
  • Java 17
  • Android Gradle Plugin >=8.3.0
  • Gradle wrapper >=8.4

Check that your project is using Java 17.

Run flutter doctor -v and find the Android section, for example:

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/xyz/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /home/xyz/Android/Sdk
    • Java binary at: /snap/android-studio/155/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

3. Upgrade Android Studio

To ensure that you are using the right OpenJDK Java version, install the latest version of Android Studio, and perform a flutter clean.

4. If nothing else works:

Note

If compilation errors persist after following this guide, please search on Stack Overflow or Google before creating a new issue ticket.

  1. Check on StackOverflow: https://stackoverflow.com/search?q=error+invalid+source+release+17
  2. Check on Google: https://www.google.com/search?q=error+invalid+source+release+17
  3. Check on this issue tracker: https://github.com/fluttercommunity/plus_plugins/issues?q=error+invalid+source+release+17

If all the above fails, then create a compilation error ticket using this template: Compile Error Template

@miquelbeltran miquelbeltran added enhancement New feature or request triage documentation Improvements or additions to documentation all and removed enhancement New feature or request triage labels May 27, 2024
@fluttercommunity fluttercommunity locked as resolved and limited conversation to collaborators May 27, 2024
@miquelbeltran miquelbeltran pinned this issue May 27, 2024
@miquelbeltran
Copy link
Member Author

I will leave this ticket open and pinned for visibility. Any opened issues regarding this can me marked as duplicated and linked to this.

@miquelbeltran miquelbeltran changed the title Common compilation issues (e.g. error: invalid source release: 17) "error: invalid source release: 17" and other compilation issues May 28, 2024
@miquelbeltran
Copy link
Member Author

Since we haven't got any issues related to this for a while, closing the ticket and unpinning.

@miquelbeltran miquelbeltran unpinned this issue Jul 18, 2024
@vbuberen vbuberen pinned this issue Aug 21, 2024
@miquelbeltran miquelbeltran unpinned this issue Oct 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
all documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant