出现错误,当运行命令 `flutter build ipa` 自从 Android Studio 更新后。

huangapple go评论70阅读模式
英文:

error when running cmd flutter build ipa since android studio update

问题

我最近将Android Studio升级到Flamingo | 2022.2.1 Patch 2,然后更新了Flutter及其所有包。
以前,在Android Studio终端中运行flutter build ipa时,它可以顺利构建我的应用的.ipa文件。现在我已经升级了Android Studio,当我运行flutter build ipa时,出现了以下错误:

development@NC-MBP my_app % flutter build ipa

Archiving com.crossfiregames.my_app...
Signing iOS app for device deployment using developer identity: "Apple Development: NC (XKJ4653QSG)"
Running pod install...                                             299ms
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
    [!] Unable to find a target named `RunnerTests` in project `Runner.xcodeproj`, did find `Runner`.

    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer/target_inspector.rb:108:in `compute_targets'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer/target_inspector.rb:40:in `compute_results'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1197:in `block (3 levels) in inspect_targets_to_integrate'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1195:in `each'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1195:in `block (2 levels) in inspect_targets_to_integrate'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1193:in `each'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1193:in `block in inspect_targets_to_integrate'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `section'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1188:in `inspect_targets_to_integrate'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:107:in `analyze'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:422:in `analyze'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `section'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:243:in `resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:162:in `install!'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/command/install.rb:52:in `run'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:52:in `run'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/bin/pod:55:in `<top (required)>'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/bin/pod:25:in `load'
    /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/bin/pod:25:in `<main>'

Error running pod install

我尝试搜索给出的错误信息,[!] Unable to find a target named RunnerTests in project Runner.xcodeproj, did find Runner,但没有找到太多相关信息。有人之前遇到过这个问题吗?如果是的话,请告诉我如何解决,因为我是Flutter新手,不太了解这个问题。谢谢!

英文:

I recently updated android studio to Flamingo | 2022.2.1 Patch 2 and the followed by updating Flutter and all of its packages.
previously, when I ran flutter build ipa in the terminal in android studio, it would build my apps .ipa without any trouble. now that I've updated android studio I'm getting the below error when i run flutter build ipa.

`development@NC-MBP my_app % flutter build ipa

Archiving com.crossfiregames.my_app...
Signing iOS app for device deployment using developer identity: "Apple Development: NC (XKJ4653QSG)"
Running pod install... 299ms
CocoaPods' output:

Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
[!] Unable to find a target named `RunnerTests` in project `Runner.xcodeproj`, did find `Runner`.

/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer/target_inspector.rb:108:in `compute_targets&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer/target_inspector.rb:40:in `compute_results&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1197:in `block (3 levels) in inspect_targets_to_integrate&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1195:in `each&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1195:in `block (2 levels) in inspect_targets_to_integrate&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1193:in `each&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1193:in `block in inspect_targets_to_integrate&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `section&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1188:in `inspect_targets_to_integrate&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:107:in `analyze&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:422:in `analyze&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `section&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:243:in `resolve_dependencies&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:162:in `install!&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/command/install.rb:52:in `run&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:52:in `run&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/bin/pod:55:in `&lt;top (required)&gt;&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/bin/pod:25:in `load&#39;
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/bin/pod:25:in `&lt;main&gt;&#39;

Error running pod install`

I tried searching for the error that it is giving me, [!] Unable to find a target named RunnerTests in project Runner.xcodeproj, did find Runner.

but cannot find much info about it. has anyone had this trouble before? and if so, how do i go ahead and fix it please? I'm new to flutter and this is beyond me.

thanks so much

答案1

得分: 0

作为一种解决方法,我通常运行 flutter clean

如果这不起作用,运行 rm -r ios 然后运行 flutter create --platforms=ios,这将重新创建 iOS 目录。如果您仍然无法构建,请在 github.com/flutter/flutter/issues/new/choose 提交一个问题。

英文:

As a workaround, I typically flutter clean.

If that doesn't work, rm -r ios and flutter create --platforms=ios, which recreates the iOS directory. If you still can't build, please file an issue at github.com/flutter/flutter/issues/new/choose

答案2

得分: 0

根据错误消息,似乎存在与项目 CocoaPods 配置有关的问题。在这种情况下,让我们尝试以下步骤:

  • 从终端,在项目的根目录中运行

    pod repo update
    

    如果没有安装 CocoaPods,请运行 sudo gem install cocoapods

  • 接下来,通过运行以下命令重新安装 CocoaPods 依赖项:

    rm ios/Podfile.lock
    rm -rf ios/Pods
    pod install --project-directory=ios
    

这将删除现有的 Podfile.lock 文件以及 "Pods" 目录,从而重新安装 CocoaPods 依赖项。

最后,运行 flutter build ipa

英文:

According to the error message, it seems that there is an issue with the project CocoaPods configuration. In this case, let's try the following steps:

  • From the terminal, in the root directory of the project run

    pod repo update
    

    <sub>In case of not having CocoaPods installed, run sudo gem install cocoapods.</sub>

<br/>

  • Next, reinstall the CocoaPods dependencies, by running the following commands:

    rm ios/Podfile.lock
    rm -rf ios/Pods
    pod install --project-directory=ios
    

They remove the existing Podfile.lock file, the "Pods" directory thus reinstalling the CocoaPods dependencies.

Finally, run flutter build ipa.

答案3

得分: 0

在Podfile中,您需要找到以下文本:

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
#   target 'RunnerTests' do
#     inherit! :search_paths
#   end
end

然后将已注释掉的部分用注释符号(#)注释掉,然后它将像往常一样构建。

英文:

Ok, found out how to fix it. in the podfile, you need to find the below text,

    target &#39;Runner&#39; do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
#   target &#39;RunnerTests&#39; do
#     inherit! :search_paths
#   end
end

and then comment out (#) the parts that are commented out. then it will build as usual

huangapple
  • 本文由 发表于 2023年6月5日 17:44:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76405187.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定