Flutter应用程序卡在“运行Gradle任务”assembleDebug“”

xqkwcwgp  于 2023-01-14  发布在  Flutter
关注(0)|答案(2)|浏览(450)

我的flutter应用程序在从VScode运行时总是停留在running-gradle-task-assembledebug
当我在命令提示符中运行flutter run -v时,它可以工作,但不能从VSCode中运行。这个问题似乎从上周就出现了。尝试了./gradlew clean和./gradlew clean build,它有时可以工作,并从VSCode中构建
删除并创建了一个新的模拟器设备,也尝试了许多建议在线
Flutter医生的输出-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:\sdk\Android
    • Platform android-31, build-tools 30.0.2
    • ANDROID_SDK_ROOT = E:\sdk\Android
    • Java binary at: F:\Program Files\Android\Android Studio\jre\bin\java
    • 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)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 2020.3)
    • Android Studio at F:\Program Files\Android\Android 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:\MobileDevelopment\GitRepo\jigsaw\android\build.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:\Flutter\packages\flutter_tools\gradle\flutter.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:\Flutter\packages\flutter_tools\gradle\flutter.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:\MobileDevelopment\GitRepo\jigsaw\android\app\src\main\AndroidManifest.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 在它和重试。

sbtkgmzw

sbtkgmzw1#

这是由于您的gradle正在下载它的版本,但有时它的速度下载太慢,不会被下载,你可以修复它:
首先检查项目根目录中的gradle版本:

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

并检查distributionUrl,您将看到项目中正在使用哪个gradle版本以及正在下载哪个版本,因此您应该在此链接https://services.gradle.org/distributions/中下载该版本
下载后,复制并转到此目录:

C:\Users\<user name>\.gradle\wrapper\dists\gradle <your version>\<a file with weird name>\

粘贴和解压你下载的文件在这里.
每次我对你的希望都很有效。如果有任何问题,请告诉我。

2ul0zpep

2ul0zpep2#

我确实解决了这个问题
Flutter清理
然后为了重新编译项目daet文件
flutter酒吧升级

相关问题