Flutter - 记录遇到的一些问题

1、 修改包名

Could not find the built application bundle at build/ios/iphonesimulator/Runner.app.
Error launching application on iPhone 11 Pro Max.

错误的原因是在xcode中修改了display Name字段的名字 默认是Runner,将display Name修改为Runner即可 ,通过 bundle Name 修改包名

2、 MuMu运行安卓闪退

[ERROR:flutter/shell/gpu/gpu_surface_gl.cc(70)] Failed to setup Skia Gr context.
Could not update files on device: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:65203/vcd6t35L_rE=/

[解决办法]

解决办法1 终端运行 flutter run --enable-software-rendering
解决办法2,mian 编辑加 --enable-software-rendering

3、 flutter 编译运行失败,显示以下提示:

error: Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator. (in target 'Runner' from project 'Runner')

Could not build the precompiled application for the device.

It appears that your application still contains the default signing identifier.
Try replacing 'com.example' with your signing id in Xcode:
  open iOS/Runner.xcworkspace

[解决办法]
删除 iOS- Flutter - APP.framework 文件夹

image.png

4、 flutter 警告:

warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 4.3, 
but the range of supported deployment target versions is 8.0 to 13.4.99.
 (in target 'FMDB' from project 'Pods')

[解决办法]
Podfile 添加

 config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'

image.png

4、 flutter 运行 iOS 报错:


Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. 
Please specify a platform for this target in your Podfile. 
See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[解决办法]
去掉 #号打开注释

# platform :ios, '9.0'

4、 Podfile 过期:

Warning: Podfile is out of date
  This can cause a mismatched version of Flutter to be embedded in your app, which may result in App Store submission rejection or crashes.
  If you have local Podfile edits you would like to keep, see https://github.com/flutter/flutter/issues/24641 for instructions.
To regenerate the Podfile, run:
  rm iOS/Podfile
  警告:Podfile已过期
   这可能会导致将不匹配的Flutter版本嵌入到您的应用中,这可能导致App Store提交被拒绝或崩溃。
   如果您要保留本地Podfile编辑,请参阅https://github.com/flutter/flutter/issues/24641了解说明。
要重新生成Podfile,请运行:
   rm ios / Podfile

大多数情况是在升级flutter版本后发生的,找到Podfile文件直接删除,路径项目名称/ios/Podfile

6、 flutter真机调试一直显示loading

image.png

[解决办法]
在安装flutter的路径底下进入bin/cache,然后把下图的lockfile删除,重启编译器

image.png

7、 iOS14debug模式闪退

重现方式:

运行debug模式的程序,大退之后从桌面图标点击进入App闪退

[两种解决方案]

使用flutter的release模式 flutter run --release
使用flutter的beta版本v1.22

猜你喜欢

转载自blog.csdn.net/iotjin/article/details/104923427