【错误记录】Flutter 构建报错 ( Error: Method not found: ‘CupertinoModalPopupRoute‘. | 下载最新 Flutter SDK 版本 )

简介: 【错误记录】Flutter 构建报错 ( Error: Method not found: ‘CupertinoModalPopupRoute‘. | 下载最新 Flutter SDK 版本 )

文章目录

一、报错信息

二、问题分析

三、解决方案





一、报错信息


参考 【Flutter】Flutter Gallery 官方示例简介 博客 ;


Flutter Galley 开源项目运行时 , 部署到手机时 , 报如下错误 ;


项目地址 : https://github.com/flutter/gallery


This will generate a JSON format file containing all messages that 
need to be translated.
Launching lib\main.dart on Pixel 2 in debug mode...
Running Gradle task 'assembleDebug'...
lib/demos/cupertino/cupertino_alert_demo.dart:240:12: Error: Method not found: 'CupertinoModalPopupRoute'.
    return CupertinoModalPopupRoute<String>(
           ^^^^^^^^^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'Y:\001_DevelopTools\010_Flutter\flutter_windows_2.0.2-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'Y:\001_DevelopTools\010_Flutter\flutter_windows_2.0.2-stable\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 19s
Exception: Gradle task assembleDebug failed with exit code 1

image.png






二、问题分析


找不到方法 , 怀疑是使用了落后的 Flutter SDK 版本 , 这里更新到最新的测试版本 ;


https://flutter.dev/docs/development/tools/sdk/releases


image.png






三、解决方案


下载 2.1.0-12.2.pre 版本的 Flutter SDK ;


flutter_windows_2.1.0-12.2.pre-beta.zip

image.png



下载后解压上述 SDK 压缩包 flutter_windows_2.1.0-12.2.pre-beta.zip ;

image.png



解压后的 Flutter SDK 路径为 : Y:\001_DevelopTools\010_Flutter\flutter_windows_2.1.0-12.2.pre-beta\flutter ;


在 " File / Settings / Languages & Frameworks / Flutter " 下配置最新版本的 Flutter SDK 路径 ;


Y:\001_DevelopTools\010_Flutter\flutter_windows_2.1.0-12.2.pre-beta\flutter

image.png



在 " File / Settings / Languages & Frameworks / Dart " 下配置最新版本的 Dart SDK 路径 ;


Y:\001_DevelopTools\010_Flutter\flutter_windows_2.1.0-12.2.pre-beta\flutter\bin\cache\dart-sdk

image.png



最终程序运行成功 :


image.png

目录
相关文章
|
5月前
|
缓存 Dart 开发工具
解决Flutter报错The method ‘File.create‘ has fewer named arguments than those of overridden method
解决Flutter报错The method ‘File.create‘ has fewer named arguments than those of overridden method
74 3
|
2月前
|
IDE 开发工具
鸿蒙Flutter实战:11-使用 Flutter SDK 3.22.0
本文介绍了如何使用 Flutter SDK 3.22.0 搭建鸿蒙开发环境。首先安装 Flutter SDK 3.22.0,并通过 FVM 管理多个版本。接着配置项目,使用 `fvm use custom_3.22.0` 设置自定义 SDK 版本。添加鸿蒙平台支持并进行项目签名,最后通过 `fvm flutter run` 运行项目。详细步骤包括安装、项目配置、签名和运行,确保开发环境顺利搭建。
175 7
鸿蒙Flutter实战:11-使用 Flutter SDK 3.22.0
|
2月前
|
存储 测试技术 Shell
Flutter UT太多导致跑覆盖率报错
Flutter UT太多导致跑覆盖率报错
34 2
|
5月前
|
开发工具 iOS开发
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
206 2
|
5月前
|
消息中间件 开发工具
【Azure Service Bus】Service Bus SDK 抛出 ERROR c.a.c.a.i.ActiveClientTokenManager - Error is transient. Rescheduling authorization task at interval 1079000 ms.
【Azure Service Bus】Service Bus SDK 抛出 ERROR c.a.c.a.i.ActiveClientTokenManager - Error is transient. Rescheduling authorization task at interval 1079000 ms.
|
5月前
解决Flutter报错boxconstraints has non-normalized height/width constraints
解决Flutter报错boxconstraints has non-normalized height/width constraints
65 0
|
5月前
|
Android开发
解决Android、Flutter编译时Gradle报错:javax.net.ssl.SSLException: Connection reset
解决Android、Flutter编译时Gradle报错:javax.net.ssl.SSLException: Connection reset
582 0
|
5月前
|
JavaScript 前端开发 Java
[Android][Framework]系统jar包,sdk的制作及引用
[Android][Framework]系统jar包,sdk的制作及引用
144 0
|
2月前
|
Java Linux API
Android SDK
【10月更文挑战第21天】
107 1
|
3月前
|
程序员 开发工具 Android开发
Android|使用阿里云推流 SDK 实现双路推流不同画面
本文记录了一种使用没有原生支持多路推流的阿里云推流 Android SDK,实现同时推送两路不同画面的流的方法。
75 7