我有一个Flutter项目,如果执行命令“ flutter run”,它将卡在Running Gradle任务“ assembleDebug”上。它不会抛出错误消息,也不会执行任何操作。 这仅在我的台式机上发生。在我的笔记本电脑上,一切正常。
在下面,我将向您展示我的flutter doctor -v输出和我的flutter run -v输出,但首先,我将告诉您我已经做了什么。
我重新安装了flutter和android sdk。 我发现项目文件受到了某种程度的损坏,因此我删除了整个项目,并再次从git存储库中将其拉出。
我创建了一个带有默认示例应用程序的新项目(该项目的初始状态为flutter)(您知道可以在其中按下按钮的那个项目,它告诉您在屏幕中间按了多少次。) 刚开始有效,所以我想在尝试将moor_flutter软件包集成到我的应用程序时弄糟了它。 (我知道那是不对的,因为如果我把它弄乱了,那也不可能在我的笔记本电脑上工作,但是我很绝望。)
无论如何,我会逐步完成实施并在每次更改后运行应用程序,以便我可以检查是否出错。
第一步:在pubspec.yaml中添加依赖项
第2步:添加设置数据库和测试表。
第3步:初始化数据库类
每次更改后,我都要清理flutter应用程序,并生成一个新的“ xxx.g.dart”文件,该文件需要使用moor_flutter软件包。 一切正常。 当天晚些时候,当我恢复了动力之后,我重新回到我的电脑上,尝试再次启动我的测试应用程序,以弄清我做错了什么。我运行了我的测试应用程序,突然之间它再也无法通过“正在运行Gradle任务'assembleDebug'...”了,我也不明白为什么,因为我什么都没做。
我检查了其他有相同问题的人,并提出这是因为linux内核5.5.5-arch1-1某种程度上破坏了gradlew,但我升级了笔记本电脑以检查是否正确,但仍然可以在我的笔记本电脑上使用
flutter doctor -v输出:
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Linux, locale en_US.UTF-8)
• Flutter version 1.12.13+hotfix.8 at
/home/jan/development/languages+devtools/flutter
• Framework revision 0b8abb4724 (12 days ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /opt/android-sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = /home/jan/development/languages+devtools/android-sdk
• Java binary at:
/home/jan/development/languages+devtools/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Android Studio (version 3.5)
• Android Studio at /home/jan/development/languages+devtools/android-studio
• Flutter plugin version 43.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (1 available)
• Mi MIX 2 • 78e7ab82 • android-arm64 • Android 9 (API 28)
• No issues found!
flutter运行-v输出:
[ +16 ms] executing: [/home/jan/development/languages+devtools/flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[ +23 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] 0b8abb4724aa590dd0f429683339b1e045a1594d
[ ] executing: [/home/jan/development/languages+devtools/flutter/] git describe --match v*.*.* --first-parent --long --tags
[ +4 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v1.12.13+hotfix.8-0-g0b8abb472
[ +4 ms] executing: [/home/jan/development/languages+devtools/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +4 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [/home/jan/development/languages+devtools/flutter/] git ls-remote --get-url origin
[ +4 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +31 ms] executing: [/home/jan/development/languages+devtools/flutter/] git rev-parse --abbrev-ref HEAD
[ +4 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ +75 ms] executing: /opt/android-sdk/platform-tools/adb devices -l
[ +4 ms] Exit code 0 from: /opt/android-sdk/platform-tools/adb devices -l
[ ] List of devices attached
78e7ab82 device usb:1-7 product:chiron model:Mi_MIX_2 device:chiron transport_id:3
[ +11 ms] /opt/android-sdk/platform-tools/adb -s 78e7ab82 shell getprop
[ +85 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +66 ms] Found plugin moor_ffi at
/home/jan/development/languages+devtools/flutter/.pub-cache/hosted/pub.dartlang.org/moor_ffi-0.4.0/
[ +9 ms] Found plugin path_provider at
/home/jan/development/languages+devtools/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.1/
[ +57 ms] Found plugin moor_ffi at
/home/jan/development/languages+devtools/flutter/.pub-cache/hosted/pub.dartlang.org/moor_ffi-0.4.0/
[ +3 ms] Found plugin path_provider at
/home/jan/development/languages+devtools/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.1/
[ +41 ms] Generating
/home/jan/development/projects/second_test_proj/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +28 ms] ro.hardware = qcom
[ +30 ms] Launching lib/main.dart on Mi MIX 2 in debug mode...
[ +7 ms] executing: /opt/android-sdk/platform-tools/adb -s 78e7ab82 shell -x logcat -v time -t 1
[ +118 ms] Exit code 0 from: /opt/android-sdk/platform-tools/adb -s 78e7ab82 shell -x logcat -v time -t 1
[ +1 ms] --------- beginning of main
02-23 18:01:22.038 E/FIDOCA : ( 752): get_fp_vendor property_get : none
[ +17 ms] executing: /opt/android-sdk/platform-tools/adb version
[ +2 ms] executing: /opt/android-sdk/platform-tools/adb -s 78e7ab82 logcat -v time -T 02-23 18:01:22.038
[ +41 ms] Android Debug Bridge version 1.0.41
Version 29.0.6-6198805
Installed as /opt/android-sdk/platform-tools/adb
[ +1 ms] executing: /opt/android-sdk/platform-tools/adb start-server
[ +6 ms] Building APK
[ +12 ms] Running Gradle task 'assembleDebug'...
[ +1 ms] gradle.properties already sets `android.enableR8`
[ +1 ms] Using gradle from /home/jan/development/projects/second_test_proj/android/gradlew.
[ +4 ms] executing: /home/jan/development/languages+devtools/android-studio/jre/bin/java -version
[ +36 ms] Exit code 0 from: /home/jan/development/languages+devtools/android-studio/jre/bin/java -version
[ ] openjdk version "1.8.0_202-release"
OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
OpenJDK 64-Bit Server VM (build 25.202-b49-5587405, mixed mode)
[ +1 ms] executing: [/home/jan/development/projects/second_test_proj/android/]
/home/jan/development/projects/second_test_proj/android/gradlew -Pverbose=true
-Ptarget=/home/jan/development/projects/second_test_proj/lib/main.dart -Ptrack-widget-creation=true
-Pfilesystem-scheme=org-dartlang-root -Ptarget-platform=android-arm64 assembleDebug
[+3436 ms] Starting a Gradle Daemon, 3 busy and 9 stopped Daemons could not be reused, use --status for details
[+6993 ms] > Task :app:compileFlutterBuildDebug
[ ] [ +15 ms] executing: [/home/jan/development/languages+devtools/flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[ ] [ +19 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
谢谢您的帮助。 请原谅任何拼写错误,英语不是我的母语。 如果您需要更多信息,请询问。 :)
答案 0 :(得分:0)
因此,在尝试使用笔记本电脑上的应用程序工作后,我自己弄清楚了。 在星期日晚上,我可以将应用程序从笔记本电脑推送到智能手机,但是昨天在学校,我什么也做不了。 因此,我认为它一定是我的操作系统。我将Linux内核更改为lts版本,现在一切正常。
答案 1 :(得分:0)
andoid studio->tools->flutter->在studio中打开andoid模块
打开android模块后尝试运行。对于我在终端中出现错误后的情况。