Closed
编译安卓项目时,dart_vm_initializer会报错:No static getter 'isOhos' declared in class 'null' #1974
懿之胡Add on  Jun 3Closed at  Jun 11
懿之胡
懿之胡
Jun 3 Create

E/flutter (25338): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: NoSuchMethodError: No static getter 'isOhos' declared in class 'null'.
E/flutter (25338): Receiver: null
E/flutter (25338): Tried calling: isOhos
E/flutter (25338): #0 NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:163:5)
我的项目可以在鸿蒙系统上正常运行,但是我想统一工程,虽然安卓系统上会正常运行app,但是会因为dart_vm_initializer报错导致我的业务异常。目前的flutter sdk版本是3.27.4-ohos

likedislike
luqi_tanluqi_tanCollaborators
Jun 4 Assign zhong_ning as responsible person
zhong_ning
zhong_ningCollaborators
Jun 4 Comments:

你好开发者,请问你的应用代码中是否 用到了 if (Platform.isOhos) 这种判断?如果有需要修改为 if (Platform.operatingSystem == 'ohos') 即可。如果没有,请提供 应用的代码,我们会进一步分析问题。

likedislike
懿之胡
懿之胡
Jun 8 Comments:

你好开发者,请问你的应用代码中是否 用到了 if (Platform.isOhos) 这种判断?如果有需要修改为 if (Platform.operatingSystem == 'ohos') 即可。如果没有,请提供 应用的代码,我们会进一步分析问题。

@zhong_ning

是的,我确实是使用if (Platform.isOhos)而不是 if (Platform.operatingSystem == 'ohos')

likedislike
zhong_ning
zhong_ningCollaborators
Jun 9 Comments:

你好开发者,请问你的应用代码中是否 用到了 if (Platform.isOhos) 这种判断?如果有需要修改为 if (Platform.operatingSystem == 'ohos') 即可。如果没有,请提供 应用的代码,我们会进一步分析问题。

@zhong_ning

是的,我确实是使用if (Platform.isOhos)而不是 if (Platform.operatingSystem == 'ohos')

@JoneCoder
好的,那现在还有问题吗?如果问题解决了, 请关闭issue,感谢

likedislike
luqi_tanluqi_tanCollaborators
Jun 11 Added label: in-progress
懿之胡
懿之胡
Jun 11 Comments:

你好开发者,请问你的应用代码中是否 用到了 if (Platform.isOhos) 这种判断?如果有需要修改为 if (Platform.operatingSystem == 'ohos') 即可。如果没有,请提供 应用的代码,我们会进一步分析问题。

@zhong_ning

是的,我确实是使用if (Platform.isOhos)而不是 if (Platform.operatingSystem == 'ohos')

@JoneCoder

解决了

likedislike
懿之胡懿之胡
Jun 11 Close issue
懿之胡懿之胡
Jun 11 changed custom state from 待办的 to 已完成
luqi_tanluqi_tanCollaborators
Jun 12 Removed label: in-progress