Flutter开发HarmonyOS鸿蒙Next应用的时候APP模拟机闪退如何解决
Flutter开发HarmonyOS鸿蒙Next应用的时候APP模拟机闪退如何解决
【任务描述】
通过flutter create --platforms ohos hapdemo1, 直接运行mac DevEco-Studio, 编译可以通过,但是APP闪退。
6893 6893 I A00000/XComFlutterEngine: Thread:547668092944 [INFO:platform_view_ohos_napi.cpp(201)] nativeInvokePlatformMessageResponseCallback 12-23 17:22:41.634 6893 6893 I A00000/XComFlutterEngine: Thread:547668092944 [INFO:platform_view_ohos_napi.cpp(241)] InvokePlatformMessageResponseCallback 12-23 17:22:41.635 6893 6893 I C04209/WMSImms: [] SetSpecificBarProperty(2028): windowId:41 hapdemo10 type:2108, 1 ffffff ffffffff 0 5 12-23 17:22:41.641 6893 6893 I C04209/WMSImms: [] SetSpecificBarProperty(2028): windowId:41 hapdemo10 type:2112, 1 ffffff 66000000 0 1 12-23 17:22:41.647 6893 7064 E C02515/DGLES: [d_glGetIntegerv_special@glv3_status.cpp:2921] unknown pname 8b9b data 0 12-23 17:22:41.648 6893 7064 E C02515/DGLES: [d_glGetIntegerv_special@glv3_status.cpp:2921] unknown pname 8b9a data 0 12-23 17:22:41.671 6893 7064 I A00000/Skia: Shader compilation error 12-23 17:22:41.671 6893 7064 I A00000/Skia: ------------------------ 12-23 17:22:41.671 6893 7064 I A00000/Skia: 1 #version 300 es 12-23 17:22:41.671 6893 7064 I A00000/Skia: 2 12-23 17:22:41.671 6893 7064 I A00000/Skia: 3 // GL_EXTENSION_SKIA_CACHE 12-23 17:22:41.671 6893 7064 I A00000/Skia: 4 precision mediump float; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 5 precision mediump sampler2D; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 6 out mediump vec4 sk_FragColor; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 7 struct Varyings_S0 { 12-23 17:22:41.671 6893 7064 I A00000/Skia: 8 mediump vec4 color; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 9 highp vec2 position; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 10 }; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 11 uniform mediump vec4 ucolor_S1_c0; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 12 in mediump vec4 vcolor_S0; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 13 highp vec2 custom_mesh_fs_S0_f2Sf4(const Varyings_S0 v, out highp vec4 color) { 12-23 17:22:41.671 6893 7064 I A00000/Skia: 14 color = vec4(v.color.zyx * v.color.w, v.color.w); 12-23 17:22:41.671 6893 7064 I A00000/Skia: 15 return v.position; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 16 } 12-23 17:22:41.671 6893 7064 I A00000/Skia: 17 void main() { 12-23 17:22:41.671 6893 7064 I A00000/Skia: 18 mediump vec4 outputColor_S0; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 19 Varyings_S0 varyings; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 20 varyings.color = vcolor_S0; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 21 highp vec4 color; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 22 custom_mesh_fs_S0_f2Sf4(varyings, color); 12-23 17:22:41.671 6893 7064 I A00000/Skia: 23 outputColor_S0 = color; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 24 mediump vec4 output_S1; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 25 mediump float _5_factor = 1.0 - outputColor_S0.w; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 26 _5_factor = exp((-_5_factor * _5_factor) * 4.0) - 0.018; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 27 output_S1 = ucolor_S1_c0 * vec4(_5_factor); 12-23 17:22:41.671 6893 7064 I A00000/Skia: 28 { 12-23 17:22:41.671 6893 7064 I A00000/Skia: 29 sk_FragColor = output_S1; 12-23 17:22:41.671 6893 7064 I A00000/Skia: 30 } 12-23 17:22:41.671 6893 7064 I A00000/Skia: 31 } 12-23 17:22:41.671 6893 7064 I A00000/Skia: 32 12-23 17:22:41.671 6893 7064 I A00000/Skia: Errors: 12-23 17:22:41.671 6893 7064 I A00000/Skia: ERROR: 0:1: ‘’ : version ‘450’ is not supported 12-23 17:22:41.671 6893 7064 I A00000/Skia: ERROR: 0:2: ‘’ : #version required and missing. 12-23 17:22:41.671 6893 7064 I A00000/Skia: ERROR: 0:21: ‘in’ : syntax error: syntax error 12-23 17:22:41.671 6893 7064 I A00000/Skia: …/…/third_party/skia/src/gpu/ShaderErrorHandler.cpp:22: fatal error: “Shader compilation failed!” 12-23 17:22:41.794 6893 7089 I C057c1/IPCWorkThread: ThreadHandler 124: proto:0 policy:0 name:OS_IPC_3_7089 invoker:1505130752 12-23 17:22:41.906 6893 7092 E C01719/ffrt: 19:operator():308 <<<=== ffrt black box(BBOX) start ===>>> 12-23 17:22:41.906 6893 7092 E C01719/ffrt: 20:SaveCurrent:72 <<<=== current status ===>>> 12-23 17:22:41.906 6893 7092 E C01719/ffrt: 21:SaveWorkerStatus:116 <<<=== worker status ===>>> 12-23 17:22:41.906 6893 7092 E C01719/ffrt: 22:SaveWorkerStatus:123 qos 2: worker tid 7077 is running nothing 12-23 17:22:41.906 6893 7092 E C01719/ffrt: 23:SaveWorkerStatus:123 qos 2: worker tid 7037 is running nothing 12-23 17:22:41.906 6893 7092 E C01719/ffrt: 24:SaveWorkerStatus:123 qos 3: worker tid 7028 is running nothing 12-23 17:22:41.906 6893 7092 E C01719/ffrt: 25:SaveWorkerStatus:123 qos 3: worker tid 7026 is running nothing 12-23 17:22:41.906 6893 7092 E C01719/ffrt: 26:SaveKeyStatus:159 <<<=== key status ===>>> 12-23 17:22:41.906 6893 7092 E C01719/ffrt: 27:SaveKeyStatus:161 no key status 12-23 17:22:41.906 6893 7092 E C01719/ffrt: 28:SaveReadyQueueStatus:136 <<<=== ready queue status ===>>> 12-23 17:22:41.906 6893 7092 E C01719/ffrt: 29:operator():318 <<<=== ffrt black box(BBOX) finish ===>>>
更多关于Flutter开发HarmonyOS鸿蒙Next应用的时候APP模拟机闪退如何解决的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html
更多关于Flutter开发HarmonyOS鸿蒙Next应用的时候APP模拟机闪退如何解决的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html
针对Flutter开发HarmonyOS鸿蒙Next应用时APP模拟机闪退的问题,以下是一些可能的解决方案:
- 检查环境配置:确保已正确安装并配置了Flutter SDK、Dart SDK以及鸿蒙开发环境(如DevEco Studio),并检查各组件版本是否兼容。
- 更新项目依赖:检查
pubspec.yaml
文件中的依赖是否完整且版本兼容,尝试运行flutter pub get
更新依赖。 - 检查鸿蒙设备兼容性:确保鸿蒙设备或模拟器版本支持你正在开发的应用版本。
- 检查权限问题:在鸿蒙对应的配置文件中检查是否已声明应用所需的所有权限。
- 日志分析:使用DevEco Studio的Logcat或类似工具查看应用运行时的日志,分析闪退前的错误信息和堆栈跟踪。
- 代码审查:检查代码中是否存在空指针引用、资源未找到等明显错误。
- 清理与重建:尝试清理项目(如运行
flutter clean
)并重新构建。
如果以上方法均未能解决问题,可能是更复杂的系统或配置问题。此时,请联系官网客服获取进一步帮助,官网地址是:https://www.itying.com/category-93-b0.html。