Flutter 插件项目:sign_in_apple 未找到。请更新 settings.gradle

Flutter Plugin project :sign_in_apple not found. Please update settings.gradle

在Android31.

构建flutter项目时遇到这个问题

错误:

Plugin project :sign_in_apple not found. Please update settings.gradle.

FAILURE: Build failed with an exception.

* Where:
Script '/Users/myusername/fluttersdk/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 421

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Cannot invoke method afterEvaluate() on null object

查看将 Apple SignIn 添加到 android 的步骤。 https://pub.dev/packages/sign_in_with_apple

您只需将这段代码替换成 android>>settings.gradle

include ':app'

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
    pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}

plugins.each { name, path ->
    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
    include ":$name"
    project(":$name").projectDir = pluginDirectory
}