美文网首页
Flutter Could not find protoc-3.

Flutter Could not find protoc-3.

作者: 侯歌 | 来源:发表于2022-08-02 09:01 被阅读0次

苹果M1电脑芯片架构问题
Flutter 项目里用的flutter_blue库比较老,导致报该错误

解决办法

不要直接打开Flutter项目,用Android Studio打开项目里的android目录,


20220802085758.jpg

由于我的项目是因为flutter_blue导致的问题,所以找到如上图所示的位置,打开flutter_blue下的build.gradle文件,做如下修改

protobuf {
    protoc {
        if (osdetector.os == "osx") {
            artifact = 'com.google.protobuf:protoc:3.11.4:osx-x86_64'
        } else {
            artifact = 'com.google.protobuf:protoc:3.11.4'
        }
    }
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java {
                    option "lite"
                }
            }
        }
    }
}

重新运行项目就可以了

相关文章

网友评论

      本文标题:Flutter Could not find protoc-3.

      本文链接:https://www.haomeiwen.com/subject/lwbdwrtx.html