Tal*_*eid 19 cocoapods visual-studio-code flutter flutter-packages apple-silicon
我使用的是 MacBook Pro M1(在有人说这是因为 M1 或其他原因之前,我已经使用 Flutter 和 M1 编程了好几个星期,但之后我必须重置我的 M1)...我的大问题:
\n每次运行 Pod Install 时出错,我都无法使用包含本机代码(例如shared_preferences或 )的包来启动我的项目。sqlite
我在 Stack Overflow 上进行了搜索,但到目前为止没有任何帮助。如果我在没有包的情况下启动我的项目,那么没有问题,这是我的 Flutter 代码,非常简单:
\nimport 'dart:convert';\nimport 'package:flutter/material.dart';\nimport 'package:http/http.dart';\nimport 'package:shared_preferences/shared_preferences.dart';\n\nvoid main() {\n runApp(MyApp());\n}\n\nclass MyApp extends StatelessWidget {\n // This widget is the root of your application.\n @override\n Widget build(BuildContext context) {\n return MaterialApp(\n home: Home(),\n );\n }\n\n}\n\n\n`class Home extends StatelessWidget {\n const Home({Key key}) : super(key: key);\n\n @override\n Widget build(BuildContext context) {\n return Scaffold(\n body: Center(\n child: RaisedButton.icon(\n onPressed: ()async{\n final prefs = await SharedPreferences.getInstance();\n if(prefs.containsKey("test")){\n print("available");\n }else{\n await prefs.setInt("test", 1);\n }\n final send = await post("xxx",body: {\n "query":"SELECT * FROM NEWS"\n });\n print(json.decode(send.body));\n },\n icon: Icon(Icons.person),\n label: Text("Hii")\n ),\n ),\n );\n }\n} ,\nRun Code Online (Sandbox Code Playgroud)\n这是我从 Flutter 得到的错误:
\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `sources'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1073:in `block in resolve_dependencies'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:414:in `analyze'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:238:in `resolve_dependencies'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'\n /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'\n /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'\n /usr/local/bin/pod:23:in `load'\n /usr/local/bin/pod:23:in `<main>'\n ```\n \xe2\x80\x95\xe2\x80\x95\xe2\x80\x95 TEMPLATE END \xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\n [!] Oh no, an error occurred.\n Search for existing GitHub issues similar to yours:\n https://github.com/CocoaPods/CocoaPods/search?q=dlsym%280x7fdfa0da8bc0%2C+Init_ffi_c%29%3A+symbol+not+found+-+%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.14.2%2Flib%2Fffi_c.bundle&type=Issues\n If none exists, create a ticket, with the template displayed above, on:\n https://github.com/CocoaPods/CocoaPods/issues/new\n Be sure to first read the contributing guide for details on how to properly submit a ticket:\n https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md\n Don't forget to anonymize any private data!\n Looking for related issues on cocoapods/cocoapods...\n Found no similar issues. To create a new issue, please visit:\n https://github.com/cocoapods/cocoapods/issues/new\nError output from CocoaPods:\n\xe2\x86\xb3\n [!] Automatically assigning platform `iOS` with version `12.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.\nRun Code Online (Sandbox Code Playgroud)\n我编辑了 Podfile 并指定了一个平台,但没有任何帮助。以下是一些细节:
\nFlutter Version = 1.22.5 (I tried also the newest version 1.22.6)\nXcode Version = 12.3 (I tried also the newest version 12.4)\nCocoa-pods = 1.10.0 ((I tried also the newest version 1.10.1)\nRun Code Online (Sandbox Code Playgroud)\n我安装并重新安装了很多次 Cocoa-pods 也没有帮助
\nahe*_*eze 44
而不是pod install,您需要执行以下操作:
arch -x86_64 pod install
Run Code Online (Sandbox Code Playgroud)
Cocoapods 仍然没有完整的 Apple Silicon 支持。使用强制终端运行命令arch -x86_64以使用 Rosetta 2。
如果这不起作用,请尝试按照本文进行操作。
Sho*_*jan 19
运行这个命令:
arch -x86_64 sudo gem install ffi
Run Code Online (Sandbox Code Playgroud)
之后,做你的flutter build ios --no-codesign或任何事情它都会很好地工作。
这里提供更多信息https://github.com/flutter/flutter/issues/70796#issue-746115543
对我来说flutter run,在我执行以下步骤之前,这些flutter build ios、arch -x86_64 pod install等等都不起作用:
sudo gem install ffi。flutter build ios --release。并且工作得很好。| 归档时间: |
|
| 查看次数: |
30510 次 |
| 最近记录: |