Flutter issues 记录

  1. Creating flutter project 卡住:

在Android Studio安装目录下的文件夹,找到 idea.properties 文件,在最后加上一句:
disable.android.first.run=true
保存,重启AS,新建flutter项目,就可以顺利的过去了

  1. Cannot find "xcodebuild". Xcode 11.0 or greater is required to develop for iOS. Could not build the precompiled application for the device.

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
如果路径不对,可以找到Xcode,拉去路径

  1. Your Xcode version may be too old for your iOS version, The service is invalid. AMDeviceSecureSta...

报错的元凶是flutter/bin/cache/artifacts/ios-deploy/ios-deploy,不知道ios-deploy可自行百度,查看当前版本为1.10,下载最新版本,使用xcode编译后,将 product 文件夹内的 ios-deploy 文件替换掉上述目录内的文件即可

  1. error: The linked and embedded framework 'App.framework' is missing one or more architectures required by this target: armv7. (in target 'Runner' from project 'Runner')
  1. 在项目根目录下:lutter clean
  2. 删除ios/Flutter/App.framework:rm -rf ios/Flutter/App.framework
  1. flutter 升级:在终端里使用 flutter upgradeflutter upgrade --force
  2. flutter upgrade 时出现如下错误 error: RPC failed; curl 18 transfer closed with outstanding read data remaining

缓存区溢出curl的postBuffer的默认值太小,需要增加缓存
使用git命令增大缓存(单位是b,524288000B也就500M左右)git config --global http.postBuffer 524288000
使用git config --list查看是否生效

  1. 应用一直 Installing and launching... ,多数情况是需要对Flutter 进行升级

  2. 删除 Derived data 下的文件,在“前往文件夹”中输入 ~/Library/Developer/Xcode/DerivedData 删除文件夹下文件

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

  1. 在项目根目录下 flutter clean
  2. 然后删除ios/Flutter/App.framework:rm -rf ios/Flutter/App.framework
  1. Android 原生工程引入 flutter_module后报错caused by org.gradle.api.internal.plugins.pluginapplicationexception failed to apply plugin

找到settings.gradle,将FAIL_ON_PROJECT_REPOS修改为PREFER_PROJECT,保存重新Build。

  1. Android 原生工程引入Flutter_moudule
  1. 在原生工程的settings.gradle中添加
include ':flutter_test_module'

setBinding(new Binding([gradle: this]))
evaluate(new File(settingsDir.parentFile, 'flutter_test_module/.android/include_flutter.groovy'))

2.在原生目录 app->build.gradle->dependencies 添加 implementation project(path: ':flutter')

  1. 在iOS原生工程中引入Flutter:在podfile文件中添加如下代码:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

flutter_application_path = '../flutter_test_module'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')


target 'flutter_test_ios' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  install_all_flutter_pods(flutter_application_path)
  # Pods for flutter_test_ios

end

后执行 pod install
再通过命令生成framework

cd /Users/xxx/Desktop/iOS\ Flutter/my_flutter 
flutter build ios-framework --output=./Flutter/

framework生成之后然后将 App.frameworkFlutter.framework 拖入Build Settings > Build Phases > Link Binary With Libraries: ,此时xcode左侧的Frameworks文件夹下会多出 App 和 Flutter两个framework,此时可编译

若报错framework not found FlutterPluginRegistrant,我进行了一下 pod update 就好了

  1. pod init 报错 Traceback (most recent call last):

sudo gem install xcodeproj can resolve it.

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值