我无法在VS代码中运行和调试Flutter应用,每当尝试运行该应用时,都会收到以下错误消息

时间:2018-11-04 00:15:23

标签: android flutter

  • 我正在使用Flutter 0.9.4•频道beta
  • Android Studio 3.2.1
  • VS代码1.28.2

每当我尝试调试并运行我的应用程序时,都会显示以下错误消息:

enter image description here

Launching lib\main.dart on Custom Phone, 8 0, API 26, 768x1280 in debug mode...
* Error running Gradle:
Exit code 1 from: C:\Users\Ketan\Documents\Flutter\hello\android\gradlew.bat app:properties:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Ketan\Documents\Flutter\hello\android\app\build.gradle' line: 25

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all files for configuration 'classpath'.
   > Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar

* 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
Please review your Gradle project setup in the android/ folder.

1 个答案:

答案 0 :(得分:0)

尝试从flutter ducomentation:

更新您的路径

如果您希望在常规Windows命令提示符下运行Flutter命令,请执行以下步骤以将Flutter添加到PATH环境变量中:

  • 转到
  

“控制面板>用户帐户>用户帐户>更改我的环境   变量”

  • 在“用户变量”下,检查是否有一个名为“路径”的条目:

  • 如果该条目确实存在,请使用;将完整路径附加到flutter\bin上。作为现有值的分隔符。

  • 如果该条目不存在,请创建一个名为Path的新用户变量,并将其值从pathflutter\bin完整。 重新启动Windows以完全应用此更改。