【注意】Flutter 1.24 FlutterMain被废弃了的替代方案|flutterAssetsDir on a null

【注意】Flutter 1.24 FlutterMain被废弃了的替代方案|flutterAssetsDir on a null

Flutter 1.24 FlutterMain被废弃了,用FlutterMain.findAppBundlePath()换成HiFlutterLoader.get(),同时也能fix:

java.lang.NullPointerException: Attempt to read from field 'java.lang.String io.flutter.embedding.engine.loader.FlutterApplicationInfo.flutterAssetsDir' on a null object reference

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
提问者 CrazyCodeBoy 2020-11-18 22:59:49

将:

flutterEngine.dartExecutor.executeDartEntrypoint(
DartEntrypoint(
FlutterMain.findAppBundlePath(),
moduleName
)
)

修改为:

flutterEngine.dartExecutor.executeDartEntrypoint(
// Flutter 1.24 FlutterMain被废弃了,用FlutterMain.findAppBundlePath()换成HiFlutterLoader.get()
// ,以fix java.lang.NullPointerException: Attempt to read from field 'java.lang.String io.flutter.embedding.engine.loader.FlutterApplicationInfo.flutterAssetsDir' on a null object reference
DartEntrypoint(
HiFlutterLoader.get().findAppBundlePath(),
moduleName
)
)


问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师