flutter run --release
Launching lib/main.dart on motorola one vision in release mode...
Running Gradle task 'assembleRelease'... 3.6s
✓ Built build/app/outputs/flutter-apk/app-release.apk (6.6MB).
Flutter run key commands.
h List all available interactive commands.
c Clear the screen
q Quit (terminate the application on the device).
D/FlutterBluePlugin(20889): onAttachedToEngine
D/FlutterBluePlugin(20889): setup
D/FlutterBluePlugin(20889): onAttachedToActivity
E/flutter (20889): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(startScan, Field androidScanMode_ for j.e0 not found. Known fields are [private int j.e0.h, private k.b0$i j.e0.i, private boolean j.e0.j, private static final j.e0 j.e0.k, private static volatile k.a1 j.e0.l], java.lang.RuntimeException: Field androidScanMode_ for j.e0 not found. Known fields are [private int j.e0.h, private k.b0$i j.e0.i, private boolean j.e0.j, private static final j.e0 j.e0.k, private static volatile k.a1 j.e0.l]
E/flutter (20889): at k.v0.n0(Unknown Source:72)
E/flutter (20889): at k.v0.T(Unknown Source:655)
E/flutter (20889): at k.v0.R(Unknown Source:12)
E/flutter (20889): at k.k0.e(Unknown Source:60)
E/flutter (20889): at k.k0.a(Unknown Source:49)
E/flutter (20889): at k.d1.d(Unknown Source:17)
E/flutter (20889): at k.d1.e(Unknown Source:4)
E/flutter (20889): at k.z$a.z(Unknown Source:9)
E/flutter (20889): at k.z$a.y(Unknown Source:4)
E/flutter (20889): at k.z$a.o(Unknown Source:0)
E/flutter (20889): at k.a$a.n(Unknown Source:2)
E/flutter (20889): at j.h.K(Unknown Source:10)
E/flutter (20889): at j.h.C(Unknown Source:2)
E/flutter (20889): at j.h.i(Unknown Source:0)
E/flutter (20889): at j.d.a(Unknown Source:6)
E/flutter (20889): at j.h.v(Unknown Source:49)
E/flutter (20889): at j.h.d(Unknown Source:1544)
E/flutter (20889): at y.j$a.a(Unknown Source:17)
E/flutter (20889): at m.c.j(Unknown Source:18)
E/flutter (20889): at m.c.k(Unknown Source:20)
E/flutter (20889): at m.c.g(Unknown Source:0)
E/flutter (20889): at m.b.run(Unknown Source:12)
E/flutter (20889): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (20889): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (20889): at android.os.Looper.loop(Looper.java:250)
E/flutter (20889): at android.app.ActivityThread.main(ActivityThread.java:7806)
E/flutter (20889): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (20889): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter (20889): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
E/flutter (20889): , null)
E/flutter (20889): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607)
E/flutter (20889): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:177)
E/flutter (20889): <asynchronous suspension>
E/flutter (20889): #2 FlutterBluePlus.scan (package:flutter_blue_plus/src/flutter_blue_plus.dart:145)
E/flutter (20889): <asynchronous suspension>
E/flutter (20889): #3 _httpConnectionHook.<anonymous closure> (dart:_http/embedder_config.dart:21)
E/flutter (20889): <asynchronous suspension>
E/flutter (20889):
当我尝试扫描设备时,我遇到了这个错误
但是当我在调试模式下运行应用程序时,它可以正常运行
我只使用了flutter_blue_plus插件 flutter_blue_plus:^1.1.2
这是我的Flutter doctor:
/opt/homebrew/Caskroom/flutter/2.8.1/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 2.10.2, on macOS 12.2 21D49 darwin-arm, locale en-GB)
• Flutter version 2.10.2 at /opt/homebrew/Caskroom/flutter/2.8.1/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 097d3313d8 (9 days ago), 2022-02-18 19:33:08 -0600
• Engine revision a83ed0e5e3
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/shaikmuzammilahmed/Library/Android/sdk
• Platform android-32, build-tools 32.0.0
• ANDROID_HOME = /Users/shaikmuzammilahmed/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.11+0-b60-7772763)
[✓] VS Code (version 1.64.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• motorola one vision (mobile) • adb-ZF6224N9MH-ZBFJSA._adb-tls-connect._tcp. • android-arm64 • Android 11 (API 30)
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.109
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
shrinkResources
在android/app/build.gradle
中启用了吗? - Rohith Nambiar