1
Dnlyao OP 在真机编译运行。
lutter ( 7085): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, Field state_ for t2.i not found. Known fields are [private int t2.i.e, private static final t2.i t2.i.f, private static volatile r1.a1 t2.i.g], null, java.lang.RuntimeException: Field state_ for t2.i not found. Known fields are [private int t2.i.e, private static final t2.i t2.i.f, private static volatile r1.a1 t2.i.g] E/flutter ( 7085): at r1.v0.n0(Unknown Source:72) E/flutter ( 7085): at r1.v0.T(Unknown Source:698) E/flutter ( 7085): at r1.v0.R(Unknown Source:12) E/flutter ( 7085): at r1.k0.e(Unknown Source:60) E/flutter ( 7085): at r1.k0.a(Unknown Source:49) E/flutter ( 7085): at r1.d1.d(Unknown Source:17) E/flutter ( 7085): at r1.d1.e(Unknown Source:4) E/flutter ( 7085): at r1.z.A(Unknown Source:4) E/flutter ( 7085): at r1.z$a.C(Unknown Source:9) E/flutter ( 7085): at r1.z$a.B(Unknown Source:0) E/flutter ( 7085): at t2.a.a(Unknown Source:775) E/flutter ( 7085): at j3.k$a.a(Unknown Source:17) E/flutter ( 7085): at w2.c.l(Unknown Source:18) E/flutter ( 7085): at w2.c.m(Unknown Source:40) E/flutter ( 7085): at w2.c.i(Unknown Source:0) E/flutter ( 7085): at w2.b.run(Unknown Source:12) E/flutter ( 7085): at android.os.Handler.handleCallback(Handler.java:958) E/flutter ( 7085): at android.os.Handler.dispatchMessage(Handler.java:99) E/flutter ( 7085): at android.os.Looper.loopOnce(Looper.java:257) E/flutter ( 7085): at android.os.Looper.loop(Looper.java:368) E/flutter ( 7085): at android.app.ActivityThread.main(ActivityThread.java:8839) E/flutter ( 7085): at java.lang.reflect.Method.invoke(Native Method) E/flutter ( 7085): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572) E/flutter ( 7085): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049) E/flutter ( 7085): ) E/flutter ( 7085): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652) E/flutter ( 7085): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310) E/flutter ( 7085): <asynchronous suspension> E/flutter ( 7085): #2 FlutterBlue.state (package:flutter_blue/src/flutter_blue.dart:56) E/flutter ( 7085): <asynchronous suspension> E/flutter ( 7085): #3 AppBleService.init.<anonymous closure> (package:weight_app/services/app_ble.dart:40) E/flutter ( 7085): <asynchronous suspension> E/flutter ( 7085): |
2
Dnlyao OP 貌似找到问题了,可能是 flutter 混淆把依赖的 class 搞丢了。现在配置了保护,就能正常了。
proguard-rules.pro 位置 android\app\proguard-rules.pro -ignorewarnings -keep class io.flutter.app.** { *; } -keep class io.flutter.plugin.** { *; } -keep class io.flutter.util.** { *; } -keep class io.flutter.view.** { *; } -keep class * { public private *; } android\app\build.gradle 也需要修改,设置规制文件 buildTypes { release { signingConfig signingConfigs.release proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' // 自定义混淆规则文件 } } _____ 不知道是不是真的这个原因。要等有空才能确定...... |
3
whevether 13 天前
ext.kotlin_version 这种写法在新版 flutter 中过时了吧。 新版本是写在 settings.gradle 中了. 这种可能导致其他的依赖无统一使用指定的 kotlin 编译。
|
4
whevether 13 天前
flutter_blue 而且你这个包也过时了啊。三年前更新的。 还是更新到新版 flutter_blue_plus 吧。要不然后期升级更加工作量巨大。
|