Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 26.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
- package:url_launcher
For solutions, see https://dart.dev/go/unsound-null-safety
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
/Users/jq_chan/AndroidStudioProjects/flutter_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Flutter' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
由上面错误信息可以知道,url_launcher
这个包不支持空类型安全(null safety
)。关于null safety
,可以查看这篇文章——【译】Flutter 1.20 中悄然带来的 null safety。
.vscode/launch.json
文件中添加args
参数
"args": [
"--no-sound-null-safety"
]
完整代码如下:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "YOUR_PROJECT_NAME",
"program": "lib/main.dart",
"request": "launch",
"type": "dart",
"args": [
"--no-sound-null-safety"
]
}
]
}
在flutter test
中设置Code => Preferences => Settings => Search setting, type in “flutter test” => Dart: Flutter Test Additional Args, Add item => Add “–no-sound-null-safety” IntelliJ IDEA/Android Studio
Run --> Edit Configurations --> Add Additional Run args --> --no-sound-null-safety
【译】Flutter 1.20 中悄然带来的 null safety
Cannot run with sound null safety because dependencies don’t support null safety
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)