Flutter Podfile 未正确创建

发布于 2025-01-16 22:42:09 字数 1259 浏览 5 评论 0原文

我创建了一个新的颤振项目。这是我的 pubspec.yaml 文件:

name: app_name
description: App Name

version: 1.0.0+1

environment:
  sdk: ">=2.16.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_bloc: ^7.3.1
  flutter_localizations:
    sdk: flutter
  get_it: ^7.1.3
  floor: ^1.2.0
  flutter_speed_dial: ^5.0.0+1

  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^1.0.0
  flutter_launcher_icons: ^0.9.2
  floor_generator: ^1.2.0
  build_runner: ^2.1.2

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon/logo.png"

flutter:
  uses-material-design: true

  module:
    androidX: true
    androidPackage: com.example.appname
    iosBundleIdentifier: com.example.appname

当我运行以下命令时:

flutter pub get pod初始化 pod install

podfile 已创建,但仅包含以下内容:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

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

  # Pods for Runner

end

当我尝试运行该应用程序时,出现以下错误: 沙箱与 Podfile.lock 不同步。运行“pod install”或更新您的 CocoaPods 安装

有人知道我该如何解决这个问题吗?

I created a new flutter project. This is my pubspec.yaml file:

name: app_name
description: App Name

version: 1.0.0+1

environment:
  sdk: ">=2.16.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_bloc: ^7.3.1
  flutter_localizations:
    sdk: flutter
  get_it: ^7.1.3
  floor: ^1.2.0
  flutter_speed_dial: ^5.0.0+1

  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^1.0.0
  flutter_launcher_icons: ^0.9.2
  floor_generator: ^1.2.0
  build_runner: ^2.1.2

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon/logo.png"

flutter:
  uses-material-design: true

  module:
    androidX: true
    androidPackage: com.example.appname
    iosBundleIdentifier: com.example.appname

When I run the following commands:

flutter pub get
pod init
pod install

The podfile is created, but only with the following contents:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

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

  # Pods for Runner

end

When I try to run the app, I get the following error:
The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation

Anyone knows how I can fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷迭香的记忆 2025-01-23 22:42:09

首先清除首选项中的派生数据并将其从垃圾箱中删除
然后使用以下命令

  1. flutter clean
  2. flutter pub get
  3. cd ios
  4. pod install
  5. pod update

First clear Derived data from preference and remove it from bin as well
then use following commands

  1. flutter clean
  2. flutter pub get
  3. cd ios
  4. pod install
  5. pod update
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文