2017-01-25 34 views
0
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配置,沒有發現flutter命令異常拋出終端............... ...............................在intellij ide得到異常,fluttter演示應用程序hello_services

+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

可以使用參數傳遞給命令或全球使用flutter config--gradle-dir--android-studio-dir標誌指定gradle這個二進制文件的位置。

正如您在鏈接代碼中所看到的,我們知道如何在某些默認位置(如/Applications/Android Studio.app內部)或通過讀取路徑變量來查找gradle。我們可能可以添加更多的默認位置。

如果您認爲您的Android SDK安裝在默認位置,我們不檢查,請提交https://github.com/flutter/flutter/issues/new的錯誤,我們很樂意解決。

+0

謝謝!! ................... –

+0

,可以請你告訴如何在飛鏢和android活動之間進行導航 –

相關問題