使用向导从 Android Studio 创建了一个新的 Flutter 项目。
新创建的项目文件夹在 ios 目录中没有任何 Pods 文件夹或 podfile。
这个 Flutter.io页面指出(强调我的):
虽然 Flutter 项目的 iOS 文件夹中有一个 Podfile,但只有在添加每个平台集成所需的本机依赖项时才使用它。
我的 ios 目录中根本没有 podfile。
我在一个不同的问题中发现了这条评论,建议在 ios 模拟器上运行项目会生成文件,但在 sim 和设备上运行项目都不会为我创建任何 podfile。
我错过了新的 flutter 项目创建的 ios 方面的某些步骤吗?如果没有 podfile,我就无法添加特定于 ios 的依赖项。
的输出flutter doctor:
[?] Flutter (Channel beta, v0.5.1, on Mac OS X 10.12.6 16G1408, locale en-US)
[?] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[?] iOS toolchain - develop for iOS devices (Xcode 9.2)
[?] Android Studio (version 3.1)
[!] VS Code (version 1.25.1)
[?] Connected devices (1 available)
Run Code Online (Sandbox Code Playgroud)
Liv*_*ock 24
这是我通常做的:
ios文件夹Podfile.lock文件rm -rf Podspod cache clean --allpod deintegratepod setuppod install你可能还想做
pod repo update
我建议简单地转到您的 Flutter Package 并执行它,flutter create .
它会自动创建所有丢失的文件,甚至 Podfile。我在我的项目中使用了这个命令,并且卓有成效。
最近,我遇到了同样的问题。即使我在 pubspec.yaml 文件中添加依赖包,也没有创建 Podfile。最后,我必须在 ios 目录中手动添加一个 Pod 文件,并发出“pod deintegrate”、“pod setup”和“pod install”。
\n\n这是我的 podfile。你可以尝试一下:
\n\n# Uncomment this line to define a global platform for your project\nplatform :ios, \'9.0\'\n\n# CocoaPods analytics sends network stats synchronously affecting flutter build latency.\nENV[\'COCOAPODS_DISABLE_STATS\'] = \'true\'\n\npod \'Firebase/Core\'\npod \'FBSDKLoginKit\' #optional\npod \'GoogleAnalytics\'\n\ndef parse_KV_file(file, separator=\'=\')\n file_abs_path = File.expand_path(file)\n if !File.exists? file_abs_path\n return [];\n end\n pods_ary = []\n skip_line_start_symbols = ["#", "/"]\n File.foreach(file_abs_path) { |line|\n next if skip_line_start_symbols.any? { |symbol| line =~ /^\\s*#{symbol}/ }\n plugin = line.split(pattern=separator)\n if plugin.length == 2\n podname = plugin[0].strip()\n path = plugin[1].strip()\n podpath = File.expand_path("#{path}", file_abs_path)\n pods_ary.push({:name => podname, :path => podpath});\n else\n puts "Invalid plugin specification: #{line}"\n end\n }\n return pods_ary\nend\n\ntarget \'Runner\' do\n # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock\n # referring to absolute paths on developers\' machines.\n use_frameworks! \n system(\'rm -rf .symlinks\')\n system(\'mkdir -p .symlinks/plugins\')\n\n # Flutter Pods\n generated_xcode_build_settings = parse_KV_file(\'./Flutter/Generated.xcconfig\')\n if generated_xcode_build_settings.empty?\n puts "Generated.xcconfig must exist. If you\'re running pod install manually, make sure flutter packages get is executed first."\n end\n generated_xcode_build_settings.map { |p|\n if p[:name] == \'FLUTTER_FRAMEWORK_DIR\'\n symlink = File.join(\'.symlinks\', \'flutter\')\n File.symlink(File.dirname(p[:path]), symlink)\n pod \'Flutter\', :path => File.join(symlink, File.basename(p[:path]))\n end\n }\n\n # Plugin Pods\n plugin_pods = parse_KV_file(\'../.flutter-plugins\')\n plugin_pods.map { |p|\n symlink = File.join(\'.symlinks\', \'plugins\', p[:name])\n File.symlink(p[:path], symlink)\n pod p[:name], :path => File.join(symlink, \'ios\')\n }\nend\n\n\n#pre_install do |installer|\n # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289\n # Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}\n#end\n\npost_install do |installer|\n installer.pods_project.targets.each do |target|\n target.build_configurations.each do |config|\n config.build_settings[\'ENABLE_BITCODE\'] = \'NO\'\n config.build_settings[\'SWIFT_VERSION\'] = \'4.2\'\n end\n\n # Peter aded on 8 Oct 2018\n # workaround for https://github.com/CocoaPods/CocoaPods/issues/7463\n #target.headers_build_phase.files.each do |file|\n # file.settings = { \'ATTRIBUTES\' => [\'Public\'] }\n #end\n\n end\nend\nRun Code Online (Sandbox Code Playgroud)\n\n另外,我尝试使用 Vcode 创建一个新的 Flutter 项目。在 pubspec.yaml 文件中添加包,保存并自动创建 podfile,
\n\n使用Vcode创建一个新的Flutter项目
\n\n| 归档时间: |
|
| 查看次数: |
32347 次 |
| 最近记录: |