在intellij ide中获取异常,fluttter demo app hello_services

时间:2017-01-25 10:14:59

标签: intellij-idea flutter

Exception from flutter run: Exception: Unable to locate gradle. Please configure the path to gradle using 'flutter config --gradle-dir'.
package:flutter_tools/src/base/common.dart 31              throwToolExit
package:flutter_tools/src/android/gradle.dart 115          buildGradleProject.<async>
dart:async/future.dart 184                                 Future.Future.microtask.<fn>
package:stack_trace/src/stack_zone_specification.dart 185  StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 97   StackZoneSpecification._registerCallback.<fn>
package:stack_trace/src/stack_zone_specification.dart 185  StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 97   StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1146                                  _rootRun
dart:async/zone.dart 1026                                  _CustomZone.run
dart:async/zone.dart 924                                   _CustomZone.runGuarded
dart:async/zone.dart 951                                   _CustomZone.bindCallback.<fn>
package:stack_trace/src/stack_zone_specification.dart 185  StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 97   StackZoneSpecification._registerCallback.<fn>
package:stack_trace/src/stack_zone_specification.dart 185  StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 97   StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1150                                  _rootRun
dart:async/zone.dart 1026                                  _CustomZone.run
dart:async/zone.dart 924                                   _CustomZone.runGuarded
dart:async/zone.dart 951                                   _CustomZone.bindCallback.<fn>
dart:async/schedule_microtask.dart 41                      _microtaskLoop
dart:async/schedule_microtask.dart 50                      _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 96                   _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 149                  _RawReceivePortImpl._handleMessage
===== asynchronous gap ===========================

如果我在终端中运行flutter config,则没有发现flutter命令在终端中抛出异常............................. .................

1 个答案:

答案 0 :(得分:2)

这是尝试查找gradle的代码: https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/android/gradle.dart#L37

flutter命令位于您下载的flutter SDK的bin目录中。我们的设置文档https://flutter.io/setup/#get-the-flutter-sdk

中介绍了如何将其添加到您的路径中

您可以使用args为命令指定gradle二进制文件的位置,也可以使用带有flutter config--gradle-dir标记的--android-studio-dir全局指定。

正如您在链接代码中看到的,我们知道如何在某些默认位置(例如内部/Applications/Android Studio.app)或通过读取路径变量来查找gradle。我们可能会添加更多默认位置。

如果您认为我的Android SDK安装在默认位置,我们不会检查,请在https://github.com/flutter/flutter/issues/new提交错误,我们很乐意解决。