Home > Enterprise >  FlutterSecureStoragePlugin.java:260: error: method references are not supported in -source 7
FlutterSecureStoragePlugin.java:260: error: method references are not supported in -source 7

Time:07-03

when I build the flutter 2.10.3 app, shows error:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'...
/Users/xiaoqiangjiang/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-5.0.0/android/src/main/java/com/it_nomads/fluttersecurestorage/FlutterSecureStoragePlugin.java:250: error: lambda expressions are not supported in -source 7
            handler.post(() -> methodResult.success(result));
                            ^
  (use -source 8 or higher to enable lambda expressions)
/Users/xiaoqiangjiang/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-5.0.0/android/src/main/java/com/it_nomads/fluttersecurestorage/FlutterSecureStoragePlugin.java:260: error: method references are not supported in -source 7
            handler.post(methodResult::notImplemented);
                                       ^
  (use -source 8 or higher to enable method references)
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_secure_storage:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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 8s
Exception: Gradle task assembleDebug failed with exit code 1

what should I do to tweak the source version?

CodePudding user response:

Try using version 5.0.1 which has java 8.

5.0.1 # [Android] Added java 8 requirement for gradle build.

Please check the same in its changelog flutter_secure_storage

  • Related