Flutter M1 Mac上的Pod安装错误-具有本机代码(如共享\u首选项)的颤振项目

Flutter M1 Mac上的Pod安装错误-具有本机代码(如共享\u首选项)的颤振项目,flutter,visual-studio-code,cocoapods,flutter-packages,apple-silicon,Flutter,Visual Studio Code,Cocoapods,Flutter Packages,Apple Silicon,我使用的是MacBook Pro M1(在有人说这是因为M1或其他原因之前,我已经用Flatter和M1编程好几个星期了,但之后我必须重置M1)。。。我最大的问题是: 每次运行Pod Install时出现错误时,我都无法使用包含本机代码(如shared_preferences或sqlite)的包启动项目 我搜索了堆栈溢出,到目前为止没有任何帮助。如果我在没有软件包的情况下开始我的项目,那么就没有问题,这是我的颤振代码,非常简单: import 'dart:convert'; import 'pa

我使用的是MacBook Pro M1(在有人说这是因为M1或其他原因之前,我已经用Flatter和M1编程好几个星期了,但之后我必须重置M1)。。。我最大的问题是:

每次运行Pod Install时出现错误时,我都无法使用包含本机代码(如
shared_preferences
sqlite
)的包启动项目

我搜索了堆栈溢出,到目前为止没有任何帮助。如果我在没有软件包的情况下开始我的项目,那么就没有问题,这是我的颤振代码,非常简单:

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:shared_preferences/shared_preferences.dart';

void main() {
 runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Home(),
    );
  }

}


`class Home extends StatelessWidget {
  const Home({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: RaisedButton.icon(
          onPressed: ()async{
            final prefs = await SharedPreferences.getInstance();
            if(prefs.containsKey("test")){
              print("available");
            }else{
              await prefs.setInt("test", 1);
            }
            final send = await post("xxx",body: {
              "query":"SELECT * FROM NEWS"
            });
            print(json.decode(send.body));
          },
          icon: Icon(Icons.person),
          label: Text("Hii")
        ),
      ),
    );
  }
} ,
这是我从颤振中得到的错误:

    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `sources'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1073:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:414:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'
    ```
    ――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
    [!] Oh no, an error occurred.
    Search for existing GitHub issues similar to yours:
    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
    If none exists, create a ticket, with the template displayed above, on:
    https://github.com/CocoaPods/CocoaPods/issues/new
    Be sure to first read the contributing guide for details on how to properly submit a ticket:
    https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
    Don't forget to anonymize any private data!
    Looking for related issues on cocoapods/cocoapods...
    Found no similar issues. To create a new issue, please visit:
    https://github.com/cocoapods/cocoapods/issues/new
Error output from CocoaPods:
↳
    [!] 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`.

我安装并重新安装了很多次Cocoa pods,但它也没有任何帮助,您需要执行以下操作:

arch -x86_64 pod install     
Cocoapods仍然没有完全的苹果硅支持。使用arch-x86_64运行命令将强制终端使用Rosetta 2


如果不起作用,请尝试以下操作。

对于我来说,这些
颤振运行
颤振构建ios
arch-x86_64 pod安装
等操作在我完成这些步骤之前都不起作用:

  • 在终端中运行
    sudo gem安装ffi
  • 然后
    flatterbuildios——发布
    。
    而且工作得很好

  • 即使这对我来说也没有帮助,但是我如何才能共享我的配置来帮助其他人(我的ruby版本和位置,我的pod版本和位置)?我目前使用的终端没有罗塞塔
    arch -x86_64 pod install