Flutter Run命令不起作用-如何解决以下错误?

时间:2019-06-27 18:08:45

标签: android flutter flutter-dependencies

“ flutter run”命令崩溃。突然,它开始引发以下错误。

flutter run
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software
rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                              1.8s
Resolving dependencies...                                           9.3s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                         8.2s
Built build\app\outputs\apk\debug\app-debug.apk.
cmd: Can't find service: activity
Installing build\app\outputs\apk\app.apk...                         0.5s
Error: ADB exited with exit code 1
Performing Streamed Install

adb: failed to install C:\www\flutter\helloworld\build\app\outputs\apk\app.apk: cmd: Can't find service: package
Error launching application on Android SDK built for x86.

我试图运行“ flutter doctor”,但那里没有任何问题。

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.17763.557], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[√] Android Studio (version 3.4)
[√] VS Code (version 1.35.1)
[√] Connected device (1 available)

• No issues found!

2 个答案:

答案 0 :(得分:1)

您是否要在模拟器上运行应用程序?如果是这样,请尝试在真实设备上运行。或尝试擦除或重新创建模拟器。可能会有帮助。

答案 1 :(得分:0)

我遇到过类似的问题,但是我认为那是某种AVD问题。我解决了这一问题,创建了新设备,但是在我迷失了正确的设备之前,有很多OSX(我仍然想知道这怎么可能)崩溃,这就是为什么我认为硬件和设备之间存在某种不兼容的原因试图模仿。 tl; dr尝试用另一个虚拟设备进行更改。