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

当和flutter_inappbrowser 一起用的时候,报错 #10

Closed
LZQL opened this issue Jun 6, 2019 · 19 comments
Closed

当和flutter_inappbrowser 一起用的时候,报错 #10

LZQL opened this issue Jun 6, 2019 · 19 comments
Labels
bug Something isn't working

Comments

@LZQL
Copy link

LZQL commented Jun 6, 2019

[!] The 'Pods-Runner' target has transitive dependencies that include static binaries: (/Users/lizhangqing/Documents/Code/Learning/Flutter/Code/flutter_learning/flutter_learning/ios/Pods/CocoaLibEvent/lib/libevent.a, /Users/lizhangqing/Documents/Code/Learning/Flutter/Code/flutter_learning/flutter_learning/ios/Pods/CocoaLibEvent/lib/libevent_core.a, /Users/lizhangqing/Documents/Code/Learning/Flutter/Code/flutter_learning/flutter_learning/ios/Pods/CocoaLibEvent/lib/libevent_extra.a, /Users/lizhangqing/Documents/Code/Learning/Flutter/Code/flutter_learning/flutter_learning/ios/Pods/CocoaLibEvent/lib/libevent_pthreads.a, /Users/lizhangqing/Documents/Code/Learning/Flutter/Code/flutter_learning/flutter_learning/ios/Pods/OpenSSL-Static/lib-ios/libcrypto.a, and /Users/lizhangqing/Documents/Code/Learning/Flutter/Code/flutter_learning/flutter_learning/ios/Pods/OpenSSL-Static/lib-ios/libssl.a)

/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:81:in `block (2 levels) in verify_no_static_framework_transitive_dependencies'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `each'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `block in verify_no_static_framework_transitive_dependencies'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:70:in `each'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:70:in `verify_no_static_framework_transitive_dependencies'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:36:in `validate!'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:415:in `validate_targets'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:118:in `install!'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.5.3/libexec/bin/pod:22:in `load'
/usr/local/Cellar/cocoapods/1.5.3/libexec/bin/pod:22:in `<main>'
@LZQL
Copy link
Author

LZQL commented Jun 6, 2019

flutter_inappbrowser 的 ios 配置 可以去https://github.com/pichillilorenzo/flutter_inappbrowser 查看 IMPORTANT Note for iOS, 我就是跟着这个配置的。

@lijy91 lijy91 added the bug Something isn't working label Jun 6, 2019
@flutterbest
Copy link

我也是这个问题。。。。。咋解决的老铁

@flutterbest
Copy link

flutter_inappbrowser 的 ios 配置 可以去https://github.com/pichillilorenzo/flutter_inappbrowser 查看 IMPORTANT Note for iOS, 我就是跟着这个配置的。

这个库确实是目前最好用的额 不能抛弃啊

@flutterbest
Copy link

@blankapp

@flutterbest
Copy link

@lijy91 能修复下不

@lijy91
Copy link
Member

lijy91 commented Jun 22, 2019

@niugengyun @LZQL 还在调查,暂时未找到解决方法

@RoJoHub
Copy link

RoJoHub commented Jun 24, 2019

The Solution:

react-native-maps/react-native-maps#1923 (comment)

pre_install do |installer|
	# workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
	Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end

@lijy91
Copy link
Member

lijy91 commented Jun 24, 2019

from: facebook/flipper#254

  1. Downgrade CocoaPods to 1.6.1 (No solution for 1.7.x found yet)
$ gem uninstall cocoapods 
$ gem install cocoapods -v 1.6.1
  1. Manually add SWIFT_VERSION to Build Settings

Steps:Runner Target > Build Settings > Add User-Defined Setting

SWIFT_VERSION=4.0
  1. Modify your 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'

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

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
+  use_frameworks!

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .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('.symlinks', 'flutter')
      File.symlink(File.dirname(p[:path]), symlink)
      pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
    end
  }

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

+  # If you use `use_frameworks!` in your Podfile, 
+  # uncomment the below $static_framework array and also 
+  # the pre_install section.  This will cause Flipper and 
+  # it's dependencies to be static and all other pods to 
+  # be dynamic.
+  $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
+    'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion',
+    'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
+    'CocoaLibEvent', 'openssl-ios-bitcode', 'boost-for-react-native']
+
+  pre_install do |installer|
+    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
+    installer.pod_targets.each do |pod|
+      if $static_framework.include?(pod.name)
+        pod.instance_variable_set(:@host_requires_frameworks, false)
+        puts pod
+      end
+    end
+  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
+      config.build_settings['SWIFT_VERSION'] = '4.0'
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end
  1. Re-install
$ cd ios && pod install
  1. Run
$ flutter run

See example:

https://github.com/blankapp/flutter_flipperkit_examples/tree/master/flutter_inappbrowser_example

@LZQL
Copy link
Author

LZQL commented Jun 25, 2019

牛逼 真的详细,用心了

@flutterbest
Copy link

谢谢 测试过了 没问题了

@lijy91
Copy link
Member

lijy91 commented Jun 25, 2019

@LZQL @niugengyun 后续如果有 cocoapods 1.7.x 的解决方案我会更新到这里,你们有其他问题可以加我微信或者加进入 https://t.me/flipper4flutter 进行讨论

@flutterbest
Copy link

flutterbest commented Jun 25, 2019

@LZQL @niugengyun 后续如果有 cocoapods 1.7.x 的解决方案我会更新到这里,你们有其他问题可以加我微信或者加进入 https://t.me/flipper4flutter 进行讨论

我加你微信 我微信昵称debug

@howardwkim
Copy link

Is there a workaround for this?

[!] Error installing OpenSSL-Static
[!] /usr/bin/git clone https://github.com/bruceyibin/OpenSSL.git /var/folders/y7/h5mpxz350p9f4qmm436zjgww0000gn/T/d20190719-73328-2cv3e7 --template= --single-branch --depth 1 --branch 1.0.2.c1

Cloning into '/var/folders/y7/h5mpxz350p9f4qmm436zjgww0000gn/T/d20190719-73328-2cv3e7'...
remote: Repository not found.
fatal: repository 'https://github.com/bruceyibin/OpenSSL.git/' not found

@lijy91
Copy link
Member

lijy91 commented Jul 19, 2019

@howardwkim Please upgrade flutter_flipperkit to 0.0.19

@howardwkim
Copy link

I was using:

dependencies:
  flutter_flipperkit:
    git:
      url: https://github.com/blankapp/flutter_flipperkit
      ref: stable

Should I specify 0.0.19?

Here's s snippet from my flutter doctor -v - should I downgrade Cocoapods to 1.6.1?

[✓] Flutter (Channel stable, v1.7.8+hotfix.3, on Mac OS X 10.13.6 17G65, locale en-US)
    • Flutter version 1.7.8+hotfix.3 at /Users/howardwkim/development/flutter
    • Framework revision b712a172f9 (10 days ago), 2019-07-09 13:14:38 -0700
    • Engine revision 54ad777fd2
    • Dart version 2.4.0

 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/howardwkim/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/howardwkim/Library/Android/sdk
    • 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-1343-b01)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • CocoaPods version 1.7.4

On another note, some of the pods installed with flutter_flipperkit were causing issues when building for Release. I think it's because flipper does not work on physical devices. I've been removing flipperkit each time I build Release, which has been awful. How do you deal with this issue? Is there something that I could add to the Podfile like if build_configurations == release do exclude pod 'flipperkit'?

Thanks!

@lijy91
Copy link
Member

lijy91 commented Jul 19, 2019

  1. The current stable is equivalent to 0.0.19, you can use stable (just updated) or 0.0.19.
  2. If you use use_frameworks, you need to downgrade
  3. There is no solution right now.

@howardwkim
Copy link

I incorrectly assumed that setting to stable would automatically install the latest version. Turns out I was at 0.0.18.

I followed these instructions from to get it working for CocoaPods 1.7.5.

I included the following within the target 'Runner' do block:

target 'Runner' do

...

 $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
   'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion',
   'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
   'CocoaLibEvent', 'OpenSSL-Static', 'boost-for-react-native']

  pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
    installer.pod_targets.each do |pod|
      if $static_framework.include?(pod.name)
        def pod.build_as_static_framework?;
          true
        end
      end
    end
  end
end

pod install works (and takes a REALLY long time to finish). Unfortunately, when I run on a simulator I run into fatal error: 'FBDefines/FBDefines.h' file not found #import <FBDefines/FBDefines.h>.

@lijy91
Copy link
Member

lijy91 commented Jul 20, 2019

Please replace OpenSSL-Static to openssl-ios-bitcode, i will update the docs.

$static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
    'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion',
    'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
    'CocoaLibEvent', 'openssl-ios-bitcode', 'boost-for-react-native']

This solution seems to have problems facebook/flipper#254 (comment) , You still need cocoapods to downgrade to 1.6.1.

@kuhnroyal
Copy link

This comment facebook/flipper#478 (comment) from my issue seems to work for 1.7.5.
Can't get it to work native but everything looking better Flutter.
Compile team is insane though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants