由于 Amplify_core,Flutter 构建失败

Flutter build fails due to Amplify_core

我最近将我的 flutter 应用程序升级到 Android V2,并且还使我的代码 null 安全。

现在,当我尝试 运行 我的代码时,出现以下构建错误:

e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core- 
0.4.0\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (26, 1): 
Class 'AtomicResult' is not abstract and does not implement abstract member public abstract 
fun error(p0: String, p1: String?, p2: Any?): Unit defined in 
io.flutter.plugin.common.MethodChannel.Result
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core- 
0.4.0\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (54, 5): 
'error' overrides nothing
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core- 
0.4.0\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (66, 26): 
Type mismatch: inferred type is String? but String was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':amplify_core:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get 
more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 15s
Exception: Gradle task assembleDebug failed with exit code 1

我尝试过但无效的方法:

如有任何帮助,我们将不胜感激!

谢谢

我通过将频道从 Master 更改为 Stable 解决了这个问题。

在 Amplify 的下一个版本中,留在主频道上将不会出现此问题。

运行 这个命令 -->>

dart pub upgrade --major-versions