英文:
Flutter Project does not work on debug mode
问题
我有一个项目,在更新Flutter后,当我从Android Studio的调试按钮运行我的应用程序时,出现了一个奇怪的错误。
当前的Flutter SDK版本是3.3.5。
因为doki_app依赖于fluent_ui >=4.3.0,需要Flutter SDK版本>=3.7.0,所以版本解决失败。
但是当我从终端运行它时,一切都正常。
[✓] Flutter(通道稳定,3.7.10,在macOS 12.6 21G115 darwin-arm64上,区域设置为en-IR)
英文:
I have a project which was working fine but after updating Flutter I find a weird error when I run my app from the Android studio debug button
The current Flutter SDK version is 3.3.5.
Because doki_app depends on fluent_ui >=4.3.0 which requires Flutter SDK version
>=3.7.0, version solving failed.
but when I run it from the terminal every thing works fine.
[✓] Flutter (Channel stable, 3.7.10, on macOS 12.6 21G115 darwin-arm64, locale en-IR)
答案1
得分: 1
我猜测你的计算机上安装了两个不同版本的Flutter,分别是3.3.5
和3.7.10
。这可能是因为你的IDE有自己的设置,以确定应该在哪里查找Flutter SDK,这就是你所描述的current SDK version
所使用的内容。
从终端运行flutter命令时,它使用你的PATH环境变量
来搜索与你的命令名称匹配的可执行文件。
所以我猜测你的IDE
和PATH环境变量
指向你计算机上的两个不同的Flutter安装。
因此,要解决这个问题,你需要更新你的PATH环境变量
,以指向正确的版本。理想情况下,你应该将其指向更新的3.7.10
,如果你计划使用fluent_ui >= 4.3.0
的话。
英文:
I guess that you have two different versions of Flutter namely 3.3.5
and 3.7.10
installed on your computer. This is possible because your IDE has its own setting to know where it should look for Flutter SDK which is what is being used as described by your current SDK version
From the terminal when you are running the flutter command it uses your PATH environment variable
to search for an executable matching your command name.
So my guess is that your IDE
and PATH environment variable
points to two different Flutter installations on your computer.
Hence, to solve this you need to either update your PATH environment variable
to point to the correct version. Ideally you will need to point it to the more latest 3.7.10
if your planning on using fluent_ui >= 4.3.0
答案2
得分: 1
在您的计算机上似乎安装了多个Flutter SDK版本。在终端中,您默认的Flutter版本是3.7.10。在您的Android Studio中,似乎安装了Flutter版本3.3.5,这就是为什么您会遇到以下错误:
doki_app依赖于fluent_ui >=4.3.0,要求Flutter SDK版本 >=3.7.0,版本解决失败。
请确保在Android Studio中选择了Flutter 3.7.10。
英文:
It seems like you are have multiple flutter SDK versions installed on your computer.
In terminal you have default Flutter version 3.7.10.
In your Android Studio it seems like you have Flutter version 3.3.5, that's why you get an error:
doki_app depends on fluent_ui >=4.3.0 which requires Flutter SDK version
>=3.7.0, version solving failed.
Make sure you have Flutter 3.7.10 selected on your Anroid Studio as well.
答案3
得分: 0
请打开您项目中的 pubspec.lock
文件,然后搜索 sdks
一词,然后根据您的计算机上的 dart
和 flutter
版本更改它们的版本。
sdks:
dart: ">=2.19.2 <3.0.0"
flutter: ">=3.7.0"
重新启动 IDE 或计算机将会使其更好。
英文:
Go to pubspec.lock
file in your project and search for sdks
term, then change both the dart
and flutter
versions due to your machine's dart
and flutter
versions.
sdks:
dart: ">=2.19.2 <3.0.0"
flutter: ">=3.7.0"
An IDE or PC restart will make it better.
答案4
得分: 0
运行以下命令:
flutter clean
然后
flutter pub upgrade
然后
flutter clean
然后
flutter run
如果仍然不起作用,请运行此命令
flutter run --no-sound-null-safety
英文:
run
flutter clean
then
flutter pub upgrade
then
flutter clean
then
flutter run
if still not works run this command
flutter run --no-sound-null-safety
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论