Closed
编译安卓项目时,dart_vm_initializer会报错:No static getter 'isOhos' declared in class 'null' #1976
hid00042498Add on  Jun 3Closed at  Jun 23
hid00042498
Jun 3 Create

Thank you for using Flutter!

If you are looking for support, please check out our documentation
or consider asking a question on Stack Overflow:

Before filling the form fields, please consider the following:

Steps to reproduce

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

Expected results

我的项目可以在鸿蒙系统上正常运行,但是我想统一工程,虽然安卓系统上会正常运行app,但是会因为dart_vm_initializer报错导致我的业务异常。目前的flutter sdk版本是3.27.4-ohos

Actual results

我的项目可以在鸿蒙系统上正常运行,但是我想统一工程,虽然安卓系统上会正常运行app,但是会因为dart_vm_initializer报错导致我的业务异常。目前的flutter sdk版本是3.27.4-ohos

Code sample

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)

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]
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
CarGuo
CarGuoCollaborators
Jun 4 Comments:
luqi_tanluqi_tanCollaborators
Jun 11 Added label: in-progress
zhong_ning
zhong_ningCollaborators
Jun 11 Comments:

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

@hid00042498 你好开发者,按照这个方式,问题是否已经解决,已解决请关闭issue,谢谢!https://gitcode.com/CPF-Flutter/flutter_flutter/issues/1974 这个issue和你的问题是一样的,已经关闭了。

likedislike
huangyouhua
huangyouhuaCollaborators
Jun 23 Comments:

开发者你好,该issue已提供解决方案,issue先关闭,如果你有其他疑问,可以继续提issue。

likedislike
huangyouhuahuangyouhuaCollaborators
Jun 23 Close issue
huangyouhuahuangyouhuaCollaborators
Jun 23 changed custom state from 待办的 to 已完成