美文网首页
Flutter-打包iOS程序白屏问题

Flutter-打包iOS程序白屏问题

作者: yuyangkk | 来源:发表于2019-08-04 19:22 被阅读0次

    版本信息:flutter stable, v1.7.8+hotfix.4, on Mac OS X 10.14.6
    开发工具:Android Studio

    Flutter 项目,在debug模式下,运行到iOS手机没有任何问题,但是在release模式下,运行到手机,启动应用程序后,发现整个程序只有一个白屏,并在控制台有以下输出:

    2019-08-01 22:15:40.821919+0800 Runner[11849:2306487] Failed to find snapshot: /var/containers/Bundle/Application/AE0E4ABB-A571-4459-A4B6-BB9D582DF8A3/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin
    2019-08-01 22:15:41.050657+0800 Runner[11849:2306511] [VERBOSE-2:engine.cc(118)] Engine run configuration was invalid.
    2019-08-01 22:15:41.050747+0800 Runner[11849:2306511] [VERBOSE-2:FlutterEngine.mm(308)] Could not launch engine with configuration.
    2019-08-01 22:15:41.079060+0800 Runner[11849:2306516] flutter: Observatory listening on http://127.0.0.1:54354/Lik__xCHj9w=/
    

    猜测可能是debug和release模式切换引起的,所以想到的解决方案是重新在对应模式下build。
    解决方案如下:
    项目目录下,终端执行下面的代码:

    1. flutter clean
    2. flutter build ios --release #如果是debug环境的,可以使用:flutter build ios --debug
    
    KayedeMacBook-Pro:projectName kaye$ flutter clean
    Deleting 'build/'.
    Deleting '/Users/kaye/workspace/flutter/projectName/.dart_tool/'.
    KayedeMacBook-Pro: projectName kaye$ flutter build ios --release
    Building com.bundle.id for device (ios-release)...
    Automatically signing iOS for device deployment using specified development team in Xcode project: xxxxx
    Running pod install...                                              1.1s
    Running Xcode build...                                                  
                                                       
     ├─Building Dart code...                                    38.1s
     ├─Generating dSYM file...                                   0.3s
     ├─Stripping debug symbols...                                0.0s
     ├─Assembling Flutter resources...                           1.1s
     └─Compiling, linking and signing...                         3.8s
    Xcode build done.                                           45.9s
    Built /Users/kaye/workspace/flutter/taotao/build/ios/iphoneos/Runner.app.
    KayedeMacBook-Pro: projectName kaye$ 
    

    相关文章

      网友评论

          本文标题:Flutter-打包iOS程序白屏问题

          本文链接:https://www.haomeiwen.com/subject/xmehdctx.html