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

[Bug]: What went wrong: Execution failed for task ':device_info_plus:compileDebugJavaWithJavac'. > error: invalid source release: 17 #2809

Closed
8 tasks done
sparrow-code opened this issue Apr 2, 2024 · 4 comments
Labels
bug Something isn't working triage

Comments

@sparrow-code
Copy link

Platform

Android 13

Plugin

device_info_plus

Version

10.0.1

Flutter SDK

3.19.5

Steps to reproduce

  1. Import this library
    import 'package:device_info_plus/device_info_plus.dart';
  2. Write this function
    Future<bool> isSdk30OrHigher() async { AndroidDeviceInfo build = await DeviceInfoPlugin().androidInfo; return build.version.sdkInt >= 30; }
  3. Simple Run Your Flutter App

Code Sample

Future<bool> isSdk30OrHigher() async {
  AndroidDeviceInfo build = await DeviceInfoPlugin().androidInfo;
  return build.version.sdkInt >= 30;
}

Logs

[   +5 ms] FAILURE: Build failed with an exception.
[   +2 ms] * What went wrong:
[        ] Execution failed for task
':device_info_plus:compileDebugJavaWithJavac'.
[        ] > error: invalid source release: 17
[        ] * Try:
[        ] > Run with --debug option to get more log output.
[        ] > Run with --scan to get full insights.
[        ] * Exception is:
[        ] org.gradle.api.tasks.TaskExecutionException: Execution failed for    
task ':device_info_plus:compileDebugJavaWithJavac'.
[        ]      at
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:142)
[        ]      at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)

Flutter Doctor

√] Flutter (Channel stable, 3.19.5, on Microsoft Windows [Version
    10.0.19045.4170], locale en-US)
    • Flutter version 3.19.5 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 300451adae (5 days ago), 2024-03-27 21:54:07 -0500
    • Engine revision e76c956498
    • Dart version 3.3.3
    • DevTools version 2.31.1

[√] Windows Version (Installed version of Windows is version 10 or higher)      

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)    • Android SDK at C:\Users\SDWORLLD\AppData\Local\Android\Sdk
    • Platform android-34, build-tools 33.0.0
    • ANDROID_HOME = C:\Users\SDWORLLD\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java      
    • Java version OpenJDK Runtime Environment (build
      11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.   
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all
      of its default components

[√] Android Studio (version 2021.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      11.0.12+7-b1504.28-7817840)

[√] VS Code, 64-bit edition (version 1.83.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.84.0

[√] Connected device (4 available)
    • Infinix X6739 (mobile) • 10256313A7110979 • android-arm64  • Android 13   
      (API 33)
    • Windows (desktop)      • windows          • windows-x64    • Microsoft    
      Windows [Version 10.0.19045.4170]
    • Chrome (web)           • chrome           • web-javascript • Google Chrome      123.0.6312.58
    • Edge (web)             • edge             • web-javascript • Microsoft    
      Edge 123.0.2420.65

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.



I did not install Visual Studio Because i have to never develop application for that
and it is heavy to

Checklist before submitting a bug

  • I searched issues in this repository and couldn't find such bug/problem
  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project
@sparrow-code sparrow-code added bug Something isn't working triage labels Apr 2, 2024
@vbuberen
Copy link
Collaborator

vbuberen commented Apr 2, 2024

It is not a bug, but an issue with your configuration.

It is explicitly mentioned in changelogs that plugin now requires Java 17: https://pub.dev/packages/device_info_plus/changelog#1001

At the same time in your flutter doctor output I see that you use Java 11:

Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

You need to update your JDK.

@davidgtu
Copy link

Hi @vbuberen! Thank you for this as it helped me resolve this locally, however, I get this error in my CircleCI/Fastlane setup.

I've tried adding a step to installing JDK 17 but to no avail.

Do you have any resources on how I might be able to resolve this on CircleCI + Fastlane?

@vbuberen
Copy link
Collaborator

I get this error in my CircleCI/Fastlane setup

This is not the right place to discuss as this issue doesn't relate to the plugin, but 3rd party services.

You need to install JDK 17 and set your runner to use it. There is enough information about it in Google: https://discuss.circleci.com/t/upgrade-java-to-jdk-17/46349

@JuYiYang
Copy link

我在 CircleCI/Fastlane 设置中收到此错误

这不是讨论的正确位置,因为这个问题与插件无关,而是与第三方服务有关。

您需要安装 JDK 17 并设置您的运行程序才能使用它。谷歌中有足够的信息:https://discuss.circleci.com/t/upgrade-java-to-jdk-17/46349
Why am I using java --version on the command line to display my version as 17 when I am using flutter doctor -v to display my java version as 11
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

4 participants