Flutter 应用程序卡在"运行 Gradle 任务'组装调试'"上



当从VScode运行时,我的flutter应用程序总是停留在运行渐变任务汇编错误

当我在命令提示符下运行flutter run-v时,它可以工作,但不能从VSCode运行。这个问题似乎是从上周开始的。尝试过/gradlew干净/gradlew干净的构建,这有时有效,并且从vscode 构建

删除并创建了一个新的模拟器设备,还尝试了许多在线建议

颤振医生-v 的输出

[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19044.1415], locale en-US)
• Flutter version 2.8.1 at E:Flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (4 weeks ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at E:sdkAndroid
• Platform android-31, build-tools 30.0.2
• ANDROID_SDK_ROOT = E:sdkAndroid
• Java binary at: F:Program FilesAndroidAndroid Studiojrebinjava
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:Program Files (x86)GoogleChromeApplicationchrome.exe
[√] Android Studio (version 2020.3)
• Android Studio at F:Program FilesAndroidAndroid Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] Connected device (3 available)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86    • Android 9 (API 28) (emulator)
• Chrome (web)                 • chrome        • web-javascript • Google Chrome 97.0.4692.71
• Edge (web)                   • edge          • web-javascript • Microsoft Edge 96.0.1054.62
• No issues found!

创建了一个全新的flutter项目,并进行了gradlew清理,并收到了以下关于gradlew清洁的消息——警告模式所有

> Configure project :app
Adding a Configuration as a dependency is a confusing behavior which isn't recommended. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0. If you're interested in inheriting the dependencies from the Configuration you are adding, you should use Configuration#extendsFrom instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.artifacts.Configuration.html#org.gradle.api.artifacts.Configuration:extendsFrom(org.gradle.api.artifacts.Configuration[]) for more details.
at build_59yj46qtreisbbowxqfuhj29p$_run_closure3.doCall(D:MobileDevelopmentGitRepojigsawandroidbuild.gradle:26)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
The AbstractArchiveTask.destinationDir property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the destinationDirectory property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:destinationDir for more details.
at FlutterPlugin$_addFlutterTasks_closure20$_closure44.doCall(E:Flutterpackagesflutter_toolsgradleflutter.gradle:833)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
The AbstractArchiveTask.archiveName property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveFileName property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:archiveName for more details.
at FlutterPlugin$_addFlutterTasks_closure20$_closure44.doCall(E:Flutterpackagesflutter_toolsgradleflutter.gradle:834)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
BUILD SUCCESSFUL in 2s
2 actionable tasks: 2 up-to-date

运行gradlew构建提供

> Task :app:stripDebugDebugSymbols
Unable to strip the following libraries, packaging them as they are: libflutter.so.
> Task :app:stripProfileDebugSymbols
Unable to strip the following libraries, packaging them as they are: libapp.so, libflutter.so, libvmservice_snapshot.so
> Task :app:lint FAILED
Ran lint on variant debug: 3 issues found
Ran lint on variant release: 3 issues found
Ran lint on variant profile: 3 issues found
Wrote HTML report to file:///D:/MobileDevelopment/GitRepo/jigsaw/build/app/reports/lint-results.html
Wrote XML report to file:///D:/MobileDevelopment/GitRepo/jigsaw/build/app/reports/lint-results.xml
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lint'.
> Lint found errors in the project; aborting build.
Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android {
lintOptions {
abortOnError false
}
}
...
Errors found:
D:MobileDevelopmentGitRepojigsawandroidappsrcmainAndroidManifest.xml:5: Error: Class referenced in the manifest, com.example.jigsaw.${applicationName}, was not found in the project or the libraries [MissingClass]
android:name="${applicationName}"
~~~~~~~~~~~~~~~~~~

* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 26s
94 actionable tasks: 90 executed, 4 up-to-date

从谷歌官方文档中重新下载了flutter 2.8 sdk,其中也包含dart并重试。

这是由于你的gradle正在下载它的版本,但有时下载速度太低,无法下载,你可以修复它:

首先在项目的根目录中检查你的gradle版本:

<project name> > android > gradle > wrapper > gradle-wrapper.properties

并检查distributionUrl,您将看到哪个gradle版本正在项目中使用并正在下载,所以您应该在该链接中下载该版本https://services.gradle.org/distributions/

下载后,复制并转到以下目录:

C:Users<user name>.gradlewrapperdistsgradle <your version><a file with weird name>

在这里粘贴并解压缩您下载的文件。

每当我希望你的时候,它都对我有用。如果有任何问题请告诉我。

我确实通过首先执行解决了这个问题

颤振清除

然后,为了重新编译项目daet文件

flutter pub升级

最新更新