[英]Error "$flutterSdkpath\packages\flutter_tools\gradle\app_plugin_loader.gradle" while running the app
I am facing an issue while running the app.我在运行应用程序时遇到问题。 My flutter details are:
我的 flutter 详细信息是:
Flutter Version: 1.12.13+hotfilx.9 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.
While running the flutter run in visual studio it is showing this:在 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)
Thanks in advance for helping me.在此先感谢您对我的帮助。
Flutter projects created on the master channel will generate an android/settings.gradle
file that points to a file in the Flutter tool that's present in 1.18.0-dev.5.0 ( currently available on all channels ).在主通道上创建的 Flutter 项目将生成一个
android/settings.gradle
文件,该文件指向 Flutter 工具中的一个文件,该工具存在于1.18.0 -dev 中的 1.18.0-dev 中。
Switching from master -> stable "downgrades" Flutter relative to that change, and the file is no longer present.从 master 切换 -> stable "downgrades" Flutter 相对于该更改,并且文件不再存在。
You can work around this by regenerating your android/settings.gradle
while on stable:您可以通过在稳定时重新生成
android/settings.gradle
来解决此问题:
$ rm android/settings.gradle
$ flutter create .
See the GitHub issue for more details.有关详细信息,请参阅GitHub 问题。
Just replace the current setting.gradle file code with you wanna running version project setting.gradle.只需将当前设置.gradle 文件代码替换为您要运行的版本项目设置.gradle。 eg: Other version project: android>setting.gradle
eg:其他版本项目:android>setting.gradle
This code will be your current flutter version just replace your setting.gradle with old one or other project此代码将是您当前的 flutter 版本,只需用旧的一个或其他项目替换您的设置。gradle
Settings.gradle设置.gradle
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
Just downgrade the recent library/package you used and you'll be just fine只需降级您使用的最近的库/包,您就可以了
Changing the channel from stable to master worked for me.将频道从stable更改为master对我有用。
To view the channel:查看频道:
flutter channel
To change the channel:要更改频道:
flutter channel <channel_name>
eg flutter channel master
例如
flutter channel master
JUST go to the path sdk flutter path JUST go 到路径 sdk flutter 路径
$flutterPath\packages\flutter_tools\gradle\app_plugin_loader.gradle
and ensure the file app_plugin_loader is there, if not restore it from recycle bin or download it并确保文件 app_plugin_loader 在那里,如果没有从回收站恢复它或下载它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.