簡體   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