Unable to find a target named `RunnerTests` in project `Runner.xcodeproj`.

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

Unable to find a target named `RunnerTests` in project `Runner.xcodeproj`

问题

I have hackintosh on my HP laptop. I'm trying to run a flutter app on the iOS simulator but it's giving me this error:

[!] Unable to find a target named `RunnerTests` in project `Runner.xcodeproj`, did find `Runner`.

This is the Podfile:

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

# 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
  use_frameworks!
  use_modular_headers!

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

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

I copied the error message and googled it. I found similar issues but their solutions didn't work for me.

英文:

I have hackintosh on my HP laptop. I'm trying to run a flutter app on the iOS simulator but it's giving me this error:

[!] Unable to find a target named `RunnerTests` in project `Runner.xcodeproj`, did find `Runner`.

This is the Podfile:

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

# 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
  use_frameworks!
  use_modular_headers!

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

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

I copied the error message and googled it. I found similar issues but their solutions didn't work for me.

答案1

得分: 40

Also new to flutter, and I don't know why this error happens. But if you open your Podfile you will find along the very first lines this:

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

So, no project named "RunnerTests", what I did is to comment the use of that reference in the same file as follows:

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

Not sure why the target is being referenced there, but it works Unable to find a target named `RunnerTests` in project `Runner.xcodeproj`.

英文:

Also new to flutter, and I don't know why this error happens. But if you open your Podfile you will find along the very first lines this:

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

So, no project named "RunnerTests", what I did is to comment the use of that reference in the same file as follows:

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

Not sure why the target is being referenced there, but it works Unable to find a target named `RunnerTests` in project `Runner.xcodeproj`.

答案2

得分: 3

I have an m1 Mac and I had to use the arch -x86_64 pod install command in order to run the pod install.

我有一台M1 Mac,我不得不使用arch -x86_64 pod install命令才能运行pod install。

I had the same issue and I solved it by deleting my ios folder and then I simply used the following commands.

我遇到了同样的问题,我通过删除我的ios文件夹然后简单地使用了以下命令来解决它。

flutter create --platform ios .
cd ios
arch -x86_64 pod install | For mac m1 users
pod install | for other users

英文:

Note:- I have an m1 Mac and I had to use the arch -x86_64 pod install command in order to run the pod install.

I had the same issue and I solved it by deleting my ios folder and then I simply used the following commands.

flutter create --platform ios .
cd ios
arch -x86_64 pod install | For mac m1 users
pod install | for other users

答案3

得分: 1

错误消息“在项目 Runner.xcodeproj 中找不到名为 Runner 的目标”通常在 Xcode 中发生,当您尝试构建或运行指定 Xcode 项目中不存在的目标时会发生。似乎项目

您可以通过从您的 Flutter 项目中删除 iOS 文件夹并使用以下命令重新创建一个新的来解决这个问题

flutter create --platform ios .

确保在 info.plist 中重新配置所有内容,或者重新进行您对原生部分所做的任何更改,因为该命令将创建一个新的文件夹。

英文:

The error message "Unable to find a target named Runner in project Runner.xcodeproj" typically occurs in Xcode when you're trying to build or run a target that doesn't exist in the specified Xcode project. It seems like the project

you can resolve it by remove your iOS folder from your flutter project and recreate an new one with

flutter create --platform ios .

make sure to reconfigure every thing again in info.plist or any changes you have done in for the native because the command will create a new folder.

答案4

得分: 1

删除现有项目中的所有IOS文件夹,然后创建一个新的Flutter项目,将新项目中的IOS文件夹复制到旧项目中。

英文:

Just delete all the IOS folder existing project then create a new Flutter Project, copy the IOS folder from the new Project into the old Project

答案5

得分: 0

新的Flutter版本似乎需要一个RunnerTests配置。只需创建一个新的Flutter项目,然后比较'ios/Runner.xcodeproj/project.pbxproj'文件。

英文:

New flutter Versions seem to require a RunnerTests profile.

Just create a new flutter project and compare the 'ios/Runner.xcodeproj/project.pbxproj' files.

huangapple
  • 本文由 发表于 2023年5月14日 19:15:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76247185.html
匿名

发表评论

匿名网友

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

确定