Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting issue while running on iPhone X in debug mode #16469

Closed
arpitgoyal2008 opened this issue Apr 11, 2018 · 14 comments
Closed

Getting issue while running on iPhone X in debug mode #16469

arpitgoyal2008 opened this issue Apr 11, 2018 · 14 comments

Comments

@arpitgoyal2008
Copy link

arpitgoyal2008 commented Apr 11, 2018

Steps to Reproduce

  1. Trying to run app with firebase on iPhone X, build is failing as below.

Flutter Run

MyMBP:myproject abc$ flutter run
Running "flutter packages get" in myproject...              0.5s
Launching lib/main.dart on iPhone X in debug mode...
Running Xcode clean...                                       0.8s
Starting Xcode build...                                          
Xcode build done.                                            1.3s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
    
Xcode's output:
↳
    === BUILD TARGET GoogleToolboxForMac OF PROJECT Pods WITH CONFIGURATION Debug ===
    In file included from /Users/abc/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.1/ios/Classes/ImagePickerPlugin.m:7:
    /Users/abc/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.1/ios/Classes/ImagePickerPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone X.

## Flutter Analyze

MyMBP:myproject abc$ flutter analyze
Analyzing /Users/abc/AndroidStudioProjects/myproject...
  hint • Unused import: 'package:google_sign_in/google_sign_in.dart' at lib/main.dart:2:8 • unused_import
1 issue found.
(Ran in 5.7s)

Flutter Doctor

[✓] Flutter (Channel master, v0.2.11-pre.26, on Mac OS X 10.12.6 16G1212, locale en-IN)
    • Flutter version 0.2.11-pre.26 at /Users/abc/Documents/flutter
    • Framework revision 5cd825a8dc (28 minutes ago), 2018-04-11 12:01:28 -0700
    • Engine revision ed303c628f
    • Dart version 2.0.0-dev.47.0.flutter-23ae4fa098

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/abc/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.2, Build version 9C40b
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.0

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 23.2.2
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[!] IntelliJ IDEA Community Edition (version 2017.3.5)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.io/intellij-setup/#installing-the-plugins

[✓] Connected devices (1 available)
    • iPhone X • 66197942-93D1-49FF-949E-26E4D0B3C68F • ios • iOS 11.2 (simulator)

! Doctor found issues in 1 category.
@arpitgoyal2008
Copy link
Author

@mravn-google

@mravn-google
Copy link
Contributor

@arpitgoyal2008 Is that a Swift-based project, created with the -i swift flag?

@arpitgoyal2008
Copy link
Author

arpitgoyal2008 commented Apr 11, 2018

No, it's not a Swift project. I also tried with your patch on Podfile as

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
    # workaround for https://github.com/CocoaPods/CocoaPods/issues/7463
    target.headers_build_phase.files.each do |file|
      file.settings = { 'ATTRIBUTES' => ['Public'] }
    end
  end
end

still having the same issue

@mravn-google
Copy link
Contributor

Those Podfile workarounds should not be necessary with Cocoapods 1.5.0 (cf. #16443, flutter/plugins#483).

@arpitgoyal2008
Copy link
Author

I see, kindly help on the issue

@mravn-google
Copy link
Contributor

Can you share which plugins you have included in your project and your ios/Podfile?

@arpitgoyal2008
Copy link
Author

arpitgoyal2008 commented Apr 11, 2018

iOS Podfile

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

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

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=separator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname, :path => podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf Pods/.symlinks')
  system('mkdir -p Pods/.symlinks/flutter')
  system('mkdir -p Pods/.symlinks/plugins')

  # Flutter Pods
  generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
  end
  generated_xcode_build_settings.map { |p|
    if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
      symlink = File.join('Pods', '.symlinks', 'flutter', File.basename(p[:path]))
      File.symlink(p[:path], symlink)
      pod 'Flutter', :path => symlink
    end
  }

  # Plugin Pods
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.map { |p|
    symlink = File.join('Pods', '.symlinks', 'plugins', File.basename(p[:path]))
    File.symlink(p[:path], symlink)
    pod p[:name], :path => File.join(symlink, 'ios')
  }
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
    # workaround for https://github.com/CocoaPods/CocoaPods/issues/7463
    target.headers_build_phase.files.each do |file|
      file.settings = { 'ATTRIBUTES' => ['Public'] }
    end
  end
end

Plugins

dependencies:
  flutter:
    sdk: flutter
  image_picker: 0.1.1                                             # new
  google_sign_in: 0.3.1                                           # new
  firebase_analytics: 0.0.4                                       # new
  firebase_auth: 0.2.0                                            # new
  firebase_database: 0.0.12                                       # new
  firebase_storage: 0.0.5                                         # new

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.0

@mravn-google
Copy link
Contributor

Thanks a lot, I'll look into it immediately.

@arpitgoyal2008
Copy link
Author

Great. Thanks :)

@mravn-google
Copy link
Contributor

The Podfile you use does not contain the patch of #16273. If you patch that in, it should work (at least it does for me). You may have to delete ios/Podfile.lock and ios/Pods/ after changing the Podfile.

@mravn-google
Copy link
Contributor

You should be able to delete this workaround:

    # workaround for https://github.com/CocoaPods/CocoaPods/issues/7463
    target.headers_build_phase.files.each do |file|
      file.settings = { 'ATTRIBUTES' => ['Public'] }
    end

@arpitgoyal2008
Copy link
Author

Hey,
Adding that patch worked. Thanks a lot :)

@RobinNaggi
Copy link

Can you pls explain the patch that fixed the problem

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants