Skip to content

[connectivity_plus] Upgrading to version 2.0.1 causes 'error: lambda expressions are not supported in -source 7' #516

Description

@mzkai

System info

Issue occurs on: Android
Plugin name: connectivity_plus
Plugin version: 2.0.1

Flutter doctor output:

[✓] Flutter (Channel stable, 2.5.2, on macOS 11.6 darwin-arm)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.60.2)
[✓] Connected device (2 available)

Steps to Reproduce

Installing version 2.0.1 gives me the following error when running 'flutter build appbundle --release':

.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.0.1/android/src/main/java/dev/fluttercommunity/plus/connectivity/ConnectivityBroadcastReceiver.java:86: error: lambda expressions are not supported in -source 7
    Runnable runnable = () -> events.success(connectivity.getNetworkType());
                           ^
  (use -source 8 or higher to enable lambda expressions)
1 error

FAILURE: Build failed with an exception.

Steps taken

The following steps have been taken before running the build command:

  1. flutter clean
  2. rm -rf .pub-cache/
  3. flutter pub get
  4. flutter build appbundle --release

Changing to version 1.0.4 of the plugin and re-running the above steps solves the issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions