英文:
Flutter release app crashing and showing gray screen
问题
我在一些安卓设备上运行我的Flutter应用时遇到崩溃问题。
我已经成功调试了应用的发布版本,以下是唯一的调试输出:
W/FlutterJNI(27448): FlutterJNI.loadLibrary called more than once
W/FlutterJNI(27448): FlutterJNI.prefetchDefaultFontManager called more than once
W/FlutterJNI(27448): FlutterJNI.init called more than once
我不知道从哪里开始寻找问题的原因。
设备显示灰屏并停止工作。
英文:
I am getting a crash on some android devices when running my Flutter app.
I have been able to debug a release version of the app and this is the only debug output:
W/FlutterJNI(27448): FlutterJNI.loadLibrary called more than once
W/FlutterJNI(27448): FlutterJNI.prefetchDefaultFontManager called more than once
W/FlutterJNI(27448): FlutterJNI.init called more than once
I don´t know where should I begin to look for the reason of the issue.
The device is showing a gray screen and stops working.
答案1
得分: 2
在创建 firebaseMessagingBackgroundHandler
时,像这样注释它,加上 @pragma('vm:entry-point')
:
@pragma('vm:entry-point')
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {
}
原因在这里解释:
英文:
Wherever you create the firebaseMessagingBackgroundHandler
, annotate it with @pragma('vm:entry-point')
like this:
@pragma('vm:entry-point')
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {
}
The reason is explained here:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论