繁体   English   中英

我在 android studio 中运行我的 flutter 项目并尝试使用 iPhone 12 模拟器,但每次 Xcode 构建都失败

[英]I Run my flutter project in android studio and try to use an IPhone 12 simulator but the Xcode builld fails everytime

我正在使用 Macbook Pro 2019。我想使用 Firebase/Auth、Firebase/Firestore、Firebase/Analytics 和 Firebase/Core。 我认为 podfile 有问题。 播客文件:

# Uncomment this line to define a global platform for your project
platform :ios, '10.0'


# Add the Firebase pod for Google Analytics
#pod 'Firebase/Analytics'

# For Analytics without IDFA collection capability, use this pod instead
# pod ‘Firebase/AnalyticsWithoutAdIdSupport’

# Add the pods for any other Firebase products you want to use in your app
# For example, to use Firebase Authentication and Cloud Firestore
#pod 'Firebase/Auth'
#pod 'Firebase/Firestore'



# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  pod 'Firebase/Analytics'
  pod 'Firebase/Auth'
  pod 'Firebase/Core'
  pod 'Firebase/Firestore'


  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
 installer.pods_project.targets.each do |target|
  target.build_configurations.each do |config|
   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
  end
 end
end

颤振医生:

[✓] Flutter (Channel stable, 2.2.1, on macOS 11.2.3 20D91 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (2 available)

• No issues found!

AppDelegate.swift:

import UIKit
import Firebase

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?

  func application(_ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions:
      [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    FirebaseApp.configure()
    return true
  }
}

错误:

在 ProjectZeus 中运行“flutter pub get”……在调试模式下在 iPhone 12 Pro Max 上启动 lib/main.dart……运行 pod install……运行 Xcode 构建……Xcode 构建完成。 10.8s 无法构建 iOS 应用程序 Xcode 构建的错误输出:↳ ** BUILD FAILED **

Xcode 的输出: ↳ 1 个错误生成。 注意:使用新的构建系统 注意:并行构建目标 注意:规划构建 注意:分析工作区 注意:构建构建描述 注意:构建准备完成警告:签名和能力的能力可能无法正常运行,因为其权利使用占位符团队 ID。 要解决此问题,请在 Runner 编辑器中选择一个开发团队。 (在项目“Runner”的目标“Runner”中)

无法为模拟器构建应用程序。 在 iPhone 12 Pro Max 上启动应用程序时出错。

先感谢您

检查是否已使用 Xcode 正确添加了 google-services

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM