运行该应用程序时遇到问题。 我扑的细节是:
Flutter版本:1.12.13 + hotfilx.9
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.17763.1098], locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc2)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.[√] Android Studio (version 3.6)
[√] VS Code (version 1.44.2)
[√] Connected device (1 available)
! Doctor found issues in 1 category.
在Visual Studio中运行Flutter时,它显示如下:
Launching lib\main.dart on CPH1859 in debug mode...
FAILURE: Build failed with an exception.
* Where:
Settings file 'project_name\android\settings.gradle' line: 15
* What went wrong:
A problem occurred evaluating settings 'android'.
> Could not read script '\flutter\packages\flutter_tools\gradle\app_plugin_loader.gradle' as it does not exist.
* 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 2s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
预先感谢您的帮助。
答案 0 :(得分:27)
在主渠道上创建的Flutter项目将生成一个android/settings.gradle
文件,该文件指向Flutter工具中存在于1.18.0-dev.5.0中的文件(当前位于master, dev, and beta channels上,但没有稳定)。
从主服务器切换->相对于该更改稳定地“降级” Flutter,并且该文件不再存在。
您可以通过在稳定状态下重新生成android/settings.gradle
来解决此问题:
$ rm android/settings.gradle
$ flutter create .
有关更多详细信息,请参见GitHub issue。
答案 1 :(得分:3)
只需降级您使用的最新库/软件包,就可以了
答案 2 :(得分:2)
只需运行版本项目setting.gradle即可替换当前的setting.gradle文件代码。 例如: 其他版本项目: android> setting.gradle
此代码将是您当前的flutter版本,只需将您的setting.gradle替换为旧的一个或其他项目
Settings.gradle
r'^[^A-Z]*E[^A-Z]*S[^A-Z ]*(?= )'
答案 3 :(得分:0)
将频道从稳定更改为 master 对我有用。
要查看频道:
flutter channel
要更改频道:
flutter channel <channel_name>
例如flutter channel master